There are some tests that construct objects which try to access the current event loop in their constructors (such as Search and Game). If these tests are not declared to be async then when they are run in isolation they will raise this error:
RuntimeError: There is no current event loop in thread 'MainThread'.
However, they work when running the test suite as a whole because they will get the event loop created by previous tests. Either the tests should be converted to async functions, or the classes causing the problem need to be refactored so that they can be constructed without an event loop existing.
Currently at least these tests have the problem:
Everything in tests/unit_tests/test_matchmaker_algorithm_bucket_teams.py
The error can be reproduced by running tests like this pipenv run tests tests/unit_tests/test_matchmaker_algorithm_bucket_teams.py::test_make_teams_single_correct_size
There are some tests that construct objects which try to access the current event loop in their constructors (such as
Search
andGame
). If these tests are not declared to be async then when they are run in isolation they will raise this error:However, they work when running the test suite as a whole because they will get the event loop created by previous tests. Either the tests should be converted to async functions, or the classes causing the problem need to be refactored so that they can be constructed without an event loop existing.
Currently at least these tests have the problem:
tests/unit_tests/test_matchmaker_algorithm_bucket_teams.py
The error can be reproduced by running tests like this
pipenv run tests tests/unit_tests/test_matchmaker_algorithm_bucket_teams.py::test_make_teams_single_correct_size