1
0

conftest.py 449 B

123456789101112131415
  1. import pytest
  2. from utils import *
  3. # ref: https://stackoverflow.com/questions/22627659/run-code-before-and-after-each-test-in-py-test
  4. @pytest.fixture(autouse=True)
  5. def stop_server_after_each_test():
  6. # do nothing before each test
  7. yield
  8. # stop all servers after each test
  9. instances = set(
  10. server_instances
  11. ) # copy the set to prevent 'Set changed size during iteration'
  12. for server in instances:
  13. server.stop()