Ver Fonte

Fixed tests failing inside a Docker container

This was reported in #30.

Signed-off-by: Stan Janssen <stan.janssen@elaad.nl>
Stan Janssen há 4 anos atrás
pai
commit
a877013d0c
1 ficheiros alterados com 3 adições e 8 exclusões
  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()