From 7dc2504f2ba86955871e828e01419439feb9596b Mon Sep 17 00:00:00 2001 From: Brian Martin Date: Thu, 23 May 2019 09:20:17 -0400 Subject: [PATCH] Fix confserver test and add dev pbr Fix confserver test and add dev pbr --- Pipfile | 1 + Pipfile.lock | 10 +++++++++- bumper/confserver.py | 4 ++-- tests/test_confserver.py | 9 ++++++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Pipfile b/Pipfile index 6435d3c..b7df90c 100644 --- a/Pipfile +++ b/Pipfile @@ -15,6 +15,7 @@ nose = "*" coverage = "*" mock = "*" pylint = "*" +pbr = "*" [pipenv] allow_prereleases = true diff --git a/Pipfile.lock b/Pipfile.lock index 6024491..a824b67 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "f6a2679f2c348e81b120bfa9d06f544ed25c1fcea44d94c419e6af514579fdee" + "sha256": "6e5b4ccc879dfdf82f53f7966eac54af90f9b9a2ffd1da6f1ce126d0ca125fc9" }, "pipfile-spec": 6, "requires": {}, @@ -331,6 +331,14 @@ "index": "pypi", "version": "==1.3.7" }, + "pbr": { + "hashes": [ + "sha256:6901995b9b686cb90cceba67a0f6d4d14ae003cd59bc12beb61549bdfbe3bc89", + "sha256:d950c64aeea5456bbd147468382a5bb77fe692c13c9f00f0219814ce5b642755" + ], + "index": "pypi", + "version": "==5.2.0" + }, "pylint": { "hashes": [ "sha256:5d77031694a5fb97ea95e828c8d10fc770a1df6eb3906067aaed42201a8a6a09", diff --git a/bumper/confserver.py b/bumper/confserver.py index 1a51dc0..d18cf6f 100644 --- a/bumper/confserver.py +++ b/bumper/confserver.py @@ -1219,13 +1219,13 @@ class ConfServer: except Exception as e: confserverlog.exception("{}".format(e)) - def disconnect(self): + async def disconnect(self): try: confserverlog.info("shutting down") if self.run_async: self.confthread.join() else: - self.app.shutdown() + await self.app.shutdown() except Exception as e: confserverlog.exception("{}".format(e)) diff --git a/tests/test_confserver.py b/tests/test_confserver.py index 0de11dc..b7a4849 100644 --- a/tests/test_confserver.py +++ b/tests/test_confserver.py @@ -18,7 +18,14 @@ def async_return(result): return f def test_disconnect(): - confserver.disconnect() + + async def test_disconnect_async(): + await confserver.disconnect() + + loop = asyncio.get_event_loop() + # Test + loop.run_until_complete(test_disconnect_async()) + def test_base(): if os.path.exists("tests/tmp.db"):