-
Notifications
You must be signed in to change notification settings - Fork 272
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 pytest fixtures in unit tests instead of from_name
methods
#1985
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
what's the reasoning for this? |
@kosack As explained in #1978, I think these methods do more harm than good. They make it very easy to make mistakes like loading the wrong instrument compared to the data being analyzed. I stopped counting the occurences I had to change code from doing |
I think the use case for our unit tests is much better solved by defining common fixtures. It reduced the code already by quite a lot. I could also imagine just doing the changes in our tests and keeping |
2dd70a6
to
bbb2d38
Compare
Codecov Report
@@ Coverage Diff @@
## master #1985 +/- ##
==========================================
- Coverage 92.33% 92.32% -0.02%
==========================================
Files 193 193
Lines 15708 15725 +17
==========================================
+ Hits 14504 14518 +14
- Misses 1204 1207 +3
Continue to review full report at Codecov.
|
5014775
to
25c5fee
Compare
from_name
methods
@kosack I removed the "remove from_name" part for now and only included the changes to the fixtures. It would make it much easier to test the data model changes without constantly having to update files on the data server to include this. |
This is nice in that we don't rely on the data format. However, what about tests to read old data formats? We should still have those (perhaps not now but after the 1.0 release, to ensure backward compatibility) |
The point is, that we now do want do break backwards compatibilty. For me this means that tests checking compatibility to old data should be added after we merge the current PRs changing the data model, make a release and first thing we add tests testing files pepduced with that release? |
I would propose the following:
|
@kosack @nbiederbeck @LukasNickel Please review again |
We are preparing a number of changes to the data model, including also the instrument model and dropping support for older versions.
This is very hard to do when the tests are relying on very old files on the data server accessed via
from_name
.Here I replace all use in our unit tests of
from_name
with pytest fixtures, which are defined mostly inctapipe/conftest
so we can change them in a single location.Also, most fixtures are updated to use prod5 data.