-
Notifications
You must be signed in to change notification settings - Fork 192
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
Use more pytest fixtures in modules tests #2226
base: dev
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #2226 +/- ##
==========================================
+ Coverage 73.02% 73.06% +0.04%
==========================================
Files 78 78
Lines 8384 8384
==========================================
+ Hits 6122 6126 +4
+ Misses 2262 2258 -4 see 2 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
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.
Looks very good :)
Is your idea to move all tests to using fixtures before merging? Or would you rather start with this as a POC?
|
||
|
||
@pytest.fixture | ||
def local_modules_repo(modules_repo_dummy, tmp_dir, pipeline_dir): |
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.
We will probably need to split it into separate fixtures. For the tests you have implemented we only need the modules repo, but for example to test installing modules we will need the installation objects.
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.
True. But normally I try to go a step as small as possible. Splitting it up will be a later step when it is needed.
Co-authored-by: Júlia Mir Pedrol <mirp.julia@gmail.com>
Co-authored-by: Júlia Mir Pedrol <mirp.julia@gmail.com>
I would start small and go step by step to gain experience with the fixtures in relation to side effects created by tools and git. Otherwise we'll end up with a big PR and if possible I'd like to avoid that. |
I added the WIP label, because it doesn't yet behave as I initially expected it to. While the return values of fixtures are fixed, side effects are not. There needs to be some other handling of this. I was lately looking into in-memory file systems to see if we could speed up by caching repo states in memory to speed up tests, but I haven't had the spare time required to investigate the options. One specific idea is to use pytest-pyfakefs. |
sounds good! will have a look to pyfakefs, thanks :) |
This PR adds some fixtures to pytest via the
conftest.py
file in the tests directory. They can then be reused throughout the test suite and as a proof of concept are applied here for some tests of the modules command.PR checklist
CHANGELOG.md
is updateddocs
is updated