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

Separate test utils from tests #2235

Merged
merged 46 commits into from
Jun 23, 2023
Merged

Separate test utils from tests #2235

merged 46 commits into from
Jun 23, 2023

Conversation

flying-sheep
Copy link
Member

@flying-sheep flying-sheep commented Apr 13, 2022

This is basically the minimum amount of changes to separate things out and fix some problems with the test setup, plus unification of how we handle optional dependencies in tests.

Fixes #2225

@codecov
Copy link

codecov bot commented Apr 13, 2022

Codecov Report

Merging #2235 (fcb0a06) into master (06802b4) will increase coverage by 0.24%.
The diff coverage is 85.84%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2235      +/-   ##
==========================================
+ Coverage   71.89%   72.14%   +0.24%     
==========================================
  Files          98      104       +6     
  Lines       11518    11678     +160     
==========================================
+ Hits         8281     8425     +144     
- Misses       3237     3253      +16     
Impacted Files Coverage Δ
scanpy/testing/_pytest/__init__.py 60.86% <60.86%> (ø)
scanpy/testing/_pytest/marks.py 84.61% <84.61%> (ø)
scanpy/testing/_helpers/data.py 88.57% <88.57%> (ø)
scanpy/plotting/_tools/__init__.py 76.77% <100.00%> (ø)
scanpy/plotting/_tools/scatterplots.py 87.20% <100.00%> (-1.22%) ⬇️
scanpy/testing/_helpers/__init__.py 100.00% <100.00%> (ø)
scanpy/testing/_pytest/fixtures/__init__.py 91.66% <100.00%> (ø)
scanpy/testing/_pytest/fixtures/data.py 100.00% <100.00%> (ø)

... and 5 files with indirect coverage changes

Copy link
Member

@ivirshup ivirshup left a comment

Choose a reason for hiding this comment

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

I've written a bit more about this in the issue thread, but I would be up for a much more narrowly scoped PR. But not something this broad.

Moving utilities out of the test suite, I'm up for. Everything else, not so much.

scanpy/testing/_helpers.py Outdated Show resolved Hide resolved
scanpy/testing/_pytest/fixtures/data.py Outdated Show resolved Hide resolved
@flying-sheep
Copy link
Member Author

@ivirshup The test failures are a bug exposed by the fixture refactoring. The tests were relying on adata['uns']['pos'] being left over from a previous test run. Can you help me fix it?

@flying-sheep flying-sheep mentioned this pull request Jun 19, 2023
@ivirshup
Copy link
Member

@flying-sheep, I see you're doing some updates here.

Are you doing anything to narrow the scope of the PR as requested last go-around?

@flying-sheep
Copy link
Member Author

flying-sheep commented Jun 19, 2023

I answered that back then already.

This PR has exactly the scope necessary to separate test utils and tests.

The only thing that I can think of to add to those answers is that the repeated code for all the data fixtures is necessary to make editors understand them. A more dynamic way to make all those fixtures breaks ctrl/cmd-clicking fixtures.

scanpy/testing/_pytest/fixtures/__init__.py Outdated Show resolved Hide resolved
scanpy/testing/_pytest/fixtures/__init__.py Outdated Show resolved Hide resolved
scanpy/testing/_pytest/marks.py Outdated Show resolved Hide resolved
scanpy/tests/test_paga.py Outdated Show resolved Hide resolved
scanpy/testing/_helpers.py Outdated Show resolved Hide resolved
pyproject.toml Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
@flying-sheep flying-sheep added this to the 1.9.3 milestone Jun 22, 2023
@flying-sheep flying-sheep changed the title Fixturize data in tests, group fixtures into modules Separate test utils from tests Jun 23, 2023
@flying-sheep
Copy link
Member Author

OK, everything done as we agreed on yesterday:

  • only parametrized datasets are fixtures
  • the skip mark is now a single function.

@flying-sheep flying-sheep merged commit e5d41d4 into master Jun 23, 2023
10 checks passed
@flying-sheep flying-sheep deleted the test-utils branch June 23, 2023 12:54
@lumberbot-app
Copy link

lumberbot-app bot commented Jun 23, 2023

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
git checkout 1.9.x
git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 e5d41d4aa58a925f0fa5cfcf580cb975167a71c9
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #2235: Separate test utils from tests'
  1. Push to a named branch:
git push YOURFORK 1.9.x:auto-backport-of-pr-2235-on-1.9.x
  1. Create a PR against branch 1.9.x, I would have named this PR:

"Backport PR #2235 on branch 1.9.x (Separate test utils from tests)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the Still Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free to suggest an improvement.

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.

Separate testing utils from tests
2 participants