Explorar o código

Fixed tests failing inside a Docker container

This was reported in #30.

Signed-off-by: Stan Janssen <stan.janssen@elaad.nl>
Stan Janssen %!s(int64=4) %!d(string=hai) anos
pai
achega
a877013d0c
Modificáronse 1 ficheiros con 3 adicións e 8 borrados
  1. 3 8
      test/fixtures/simple_server.py

+ 3 - 8
test/fixtures/simple_server.py

@@ -100,17 +100,12 @@ async def _on_create_party_registration(payload):
     return 'oadrCreatedPartyRegistration', payload
 
 
-server = OpenADRServer(vtn_id=VTN_ID)
+server = OpenADRServer(vtn_id=VTN_ID, http_port=SERVER_PORT)
 server.add_handler('on_create_party_registration', _on_create_party_registration)
 server.add_handler('on_poll', _on_poll)
 
 @pytest.fixture
 async def start_server():
-    runner = web.AppRunner(server.app)
-    await runner.setup()
-    site = web.TCPSite(runner, 'localhost', SERVER_PORT)
-    await site.start()
-    print("SERVER IS NOW RUNNING")
+    await server.run_async()
     yield
-    print("SERVER IS NOW STOPPING")
-    await runner.cleanup()
+    await server.stop()