Skip to content
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

Enabled parallel tests #757

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

WisdomPill
Copy link
Member

Many things have been implemented in order to improve tests

  • tests are now generated using pytest_generate_tests so now they can be run with a single pytest command
  • tests are now parallelised using pytest-xdist
  • settings use different databases now
  • docker-compose is used to provision the environment for standalone and sentinel setups

Copy link

codecov bot commented Oct 27, 2024

Codecov Report

Attention: Patch coverage is 25.87601% with 275 lines in your changes missing coverage. Please review.

Project coverage is 37.9%. Comparing base (6321750) to head (f9f5d0c).
Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
tests/test_session.py 5.1% 227 Missing ⚠️
tests/conftest.py 29.3% 29 Missing ⚠️
tests/settings_wrapper.py 73.1% 7 Missing ⚠️
tests/test_client.py 53.4% 7 Missing ⚠️
tests/test_cache_options.py 0.0% 5 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (6321750) and HEAD (f9f5d0c). Click for more details.

HEAD has 14 uploads less than BASE
Flag BASE (6321750) HEAD (f9f5d0c)
tests 14 0
Additional details and impacted files
@@            Coverage Diff            @@
##           master    #757      +/-   ##
=========================================
- Coverage    63.2%   37.9%   -25.2%     
=========================================
  Files          43      44       +1     
  Lines        3231    3253      +22     
  Branches      244     244              
=========================================
- Hits         2039    1231     -808     
- Misses       1175    1778     +603     
- Partials       17     244     +227     
Flag Coverage Δ
mypy 37.9% <25.9%> (-<0.1%) ⬇️
tests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@ulgens ulgens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like the PR is trying to achieve too much at once. Each one of the four items listed in description calls for their own PR. I guess, xdist could be the minimal start point.

@WisdomPill
Copy link
Member Author

@ulgens xdist cannot work without pytest_generate_tests... parallelisation can't work on the same db and there is pytest-django that can't work with xdist easily in this case... 😕
so the only thing that can be separate is probably the docker-compose part which is barely a refactoring of what was there before...

now I see some issues with overriding settings, because I removed pytest-django, but I think I have an idea to solve them, will update this PR another day when I'll have time and willingness to spend it on this project 😄 .

I didn't find a way to make pytest-django work with pytest_generate_tests due to the way pytest-django initialises django settings, if you have something in mind I could lower the scope of this PR, but imho it does little more than possible to go towards the goal of parallelizing tests and make them faster

I consider going from 5 minutes per env to 1 minute a big improvement tbh so I won't surrender that easily on this PR and try to close it soon 😄

@ulgens
Copy link
Member

ulgens commented Nov 9, 2024

@WisdomPill I remember managing similar needs for different projects with relatively simpler changes but apparently I'm missing a set of details. I'm concerned about the project's history: Having a PR with this size and many changes merged into the repo makes it harder for further contributors to understand.

I consider going from 5 minutes per env to 1 minute a big improvement tbh so I won't surrender that easily on this PR and try to close it soon 😄

Mad respect there 😄

if you have something in mind I could lower the scope of this PR

I'd like to do some testing with xdist and minimal changes before monday if that's okay. I have no info about the urgency of these changes, but my goal is to be back soon with a recommendation or to discard my review.

@WisdomPill
Copy link
Member Author

I'm concerned about the project's history: Having a PR with this size and many changes merged into the repo makes it harder for further contributors to understand.

Actually the size of the PR is due to the rewrite of test_sessions.py so that it can use a session fixture so that settings can be generated with pytest_generate_tests, to be fair those tests should be checked against master of django because I believe there are some slight changes.

I'd like to do some testing with xdist and minimal changes before monday if that's okay. I have no info about the urgency of these changes, but my goal is to be back soon with a recommendation or to discard my review.

please be my guest, I am open to any improvement and I am really thankful for the time and effort you're spending in the project. You're welcome to propose any changes outside of this PR scope as well, your help is deeply appreciated.
Last but not least, if you need more time just write here, I am not in a hurry, even if I fix the issue I can wait, although I have to say merging this improvement is highly tempting 😄
There are other things to check and manage outside of this PR that are more important for a release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants