Repository: lwinterface/panini (language: python)

Issue:
Panini tests do not pass on Ubuntu with `pytest` command
On Mac and Windows `pytest` command works just fine - and all tests pass,
But on Ubuntu platform tests have some problems


Discussion / hints:
The problem is inside test_middleware_manager.py


Fix patch:
diff --git a/.circleci/config.yml b/.circleci/config.yml
new file mode 100644
index 0000000..08c71fd
--- /dev/null
+++ b/.circleci/config.yml
@@ -0,0 +1,32 @@
+version: 2.1
+jobs:
+  test:
+    machine:
+      image: ubuntu-2004:202010-01
+      docker_layer_caching: true
+    working_directory: ~/panini/
+    steps:
+      - checkout
+      - run:
+          name: Installing libraries
+          command: |
+            pip3 install pytest
+            pip3 install -r requirements/defaults.txt
+      - run:
+          name: Start containers nats and redis
+          command: |
+            docker run -p 6379:6379 -d redis
+            docker run -d -p 4222:4222 -p 6222:6222 -p 8222:8222 nats
+      - run:
+          name: Run Tests
+          command: |
+            cd ~/panini
+            mkdir results
+            timeout 300 python3 -m pytest --junitxml=results/out.xml || (echo "Doesn't finished succefully" && exit 1)
+      - store_test_results:
+          path: results
+    path:
+workflows:
+  main:
+    jobs:
+      - test


Test patch:
diff --git a/tests/test_middleware_manager.py b/tests/test_middleware_manager.py
index 5e0627d..91fcfd9 100644
--- a/tests/test_middleware_manager.py
+++ b/tests/test_middleware_manager.py
@@ -88,7 +88,7 @@ async def listen_any(self, msg, callback):
 @pytest.fixture
 def app():
     app = panini_app.App(
-        service_name="test_middleware_dict_factory",
+        service_name="test_middleware_manager",
         host="127.0.0.1",
         port=4222,
     )
@@ -98,7 +98,13 @@ def app():
         "send_request_middleware": [],
         "listen_request_middleware": [],
     }
-    return app
+    yield app
+    _MiddlewareManager.MIDDLEWARE = {
+        "send_publish_middleware": [],
+        "listen_publish_middleware": [],
+        "send_request_middleware": [],
+        "listen_request_middleware": [],
+    }
 
 
 def test_foo_middleware(app):