-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
♻️ Remove overloaded loops in tests #2674
♻️ Remove overloaded loops in tests #2674
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2674 +/- ##
========================================
- Coverage 78.0% 75.1% -2.9%
========================================
Files 636 636
Lines 26064 26073 +9
Branches 2524 2525 +1
========================================
- Hits 20342 19602 -740
- Misses 5053 5847 +794
+ Partials 669 624 -45
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice cleanup!
@@ -135,7 +135,7 @@ def services_endpoint( | |||
|
|||
|
|||
@pytest.fixture(scope="module") | |||
async def simcore_services_ready( | |||
def simcore_services_ready( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this changed to non async?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GitHK because, as stated in the PR, we can only use async fixtures with a function scope, otherwise (i.e. module or session) they must be synchronous. This is a "reasonable" limitation provided the complex situations we found when mixing loops at different scopes :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
read the PR description ;)
async def fixtures are auto-detected by pytest-aiohttp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I've missed that part. I got it, no more module or session scoped async fixtures, only function wise async.
77f6b59
to
20ed9b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx! greatly appreciated the changes in this PR
@@ -135,7 +135,7 @@ def services_endpoint( | |||
|
|||
|
|||
@pytest.fixture(scope="module") | |||
async def simcore_services_ready( | |||
def simcore_services_ready( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GitHK because, as stated in the PR, we can only use async fixtures with a function scope, otherwise (i.e. module or session) they must be synchronous. This is a "reasonable" limitation provided the complex situations we found when mixing loops at different scopes :-)
8cc58e3
to
a059446
Compare
What do these changes do?
In pytest the loop fixture is function scoped. The idea behind is to have a clean Event Loop for each test.
For different reasons, we used to overload that loop with a module scoped, or session scoped loop. This leads to weird behaviours in some tests that became a hurdle and a pain. Sometimes the loop gets replaced and the typical error message of "a future is waiting in a different loop than the current loop" would appear.
Rationale:
--> To simplify and start from a clean slate, all the module/session scoped loops were removed.
Also some of the autouse fixtures are removed. PLEASE DO NOT USE THAT FEATURE, it is not explicit and is painful when debugging.
Hint: with pytest one casn use
pytest --setup-show
, this shows how the fixtures are startedRelated issue/s
How to test
Checklist