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

Force tests in a module to be run by the same worker #2177

Merged
merged 14 commits into from
Feb 8, 2024

Conversation

eapolinario
Copy link
Collaborator

@eapolinario eapolinario commented Feb 7, 2024

Tracking issue

NA

Why are the changes needed?

flytekit unit tests started failing in the last couple of days due to the use of global shared state in test_local_cache.py. Tests are run using pytest-xdist and this PR makes it so that we run all tests in the same module in the same worker

What changes were proposed in this pull request?

We specify --dist loadscope to force tests in the same module to be picked by the same pytest worker.

I'm also:

  1. removing the pinned version of flyteidl from the setup make target.
  2. setting defaults for PYTEST_OPTS in the makefile
  3. fixing a bunch of assumptions in the unit tests that didn't play well with pytest-xdist

How was this patch tested?

Setup process

Screenshots

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Docs link

Copy link

codecov bot commented Feb 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (ea8687b) 80.43% compared to head (8d35ffe) 84.06%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2177      +/-   ##
==========================================
+ Coverage   80.43%   84.06%   +3.62%     
==========================================
  Files         176      298     +122     
  Lines       17178    23144    +5966     
  Branches     3545     3545              
==========================================
+ Hits        13817    19455    +5638     
- Misses       2732     3101     +369     
+ Partials      629      588      -41     

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

wild-endeavor
wild-endeavor previously approved these changes Feb 7, 2024
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
@pingsutw
Copy link
Member

pingsutw commented Feb 8, 2024

thank you

@eapolinario eapolinario merged commit e445200 into master Feb 8, 2024
81 of 82 checks passed
eapolinario added a commit that referenced this pull request Feb 8, 2024
* Force tests in a module to be run by the same worker

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Put link to pytest-xdist docs.

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Remove flyteidl setup make target

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Set flyteidl lower bound to 1.10.7b4

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Set a default value for PYTEST_OPTS

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Fix matching of error in test_python_entrypoint

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Disable pytest-xdist temporarily

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Remove default from makefile temporarily

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Move test that touches the local cache to test_local_cache

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Mock environment using mock.patch.dict in test_serialization

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Re-enable pytest-xdist

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Lint

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Move patching of os.environ closer to where it's required

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Check that a different key is not usable in test_secrets_manager_default

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

---------

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Co-authored-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
@eapolinario eapolinario mentioned this pull request Feb 18, 2024
3 tasks
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.

3 participants