Skip to content

Commit 7bccacd

Browse files
akbakb
authored andcommitted
Don't run client/server when collecting tests
1 parent 646a56d commit 7bccacd

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

tests/client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ async def main():
1616
print(html)
1717

1818

19-
loop = asyncio.get_event_loop()
20-
loop.run_until_complete(main())
19+
if __name__ == '__main__':
20+
loop = asyncio.get_event_loop()
21+
loop.run_until_complete(main())

tests/server.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ async def handle(self, request):
4141

4242
return web.Response(text=response)
4343

44-
45-
with contextlib.redirect_stdout(new_target=sys.stderr):
46-
app = web.Application()
47-
handler = Handler()
48-
handle = handler.handle
49-
app.add_routes([web.get("/", handle), web.get("/delay/{delay}", handle)])
50-
51-
web.run_app(app)
44+
if __name__ == '__main__':
45+
with contextlib.redirect_stdout(new_target=sys.stderr):
46+
app = web.Application()
47+
handler = Handler()
48+
handle = handler.handle
49+
app.add_routes([web.get("/", handle), web.get("/delay/{delay}", handle)])
50+
51+
web.run_app(app)

0 commit comments

Comments
 (0)