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

Add CI run that tests the package without numpy installed #252

Merged
merged 2 commits into from
Jul 13, 2024

Conversation

wshanks
Copy link
Collaborator

@wshanks wshanks commented Jul 13, 2024

Given that it is common to work with Uncertainties and numpy, it is easy to forget to check that a hard dependency on numpy has been introduced. Here an extra run is added to the CI configuration to run the tests without installing numpy.

  • Closes # (insert issue number)
  • Executed pre-commit run --all-files with no errors
  • The change is fully covered by automated unit tests
  • Documented in docs/ as appropriate
  • Added an entry to the CHANGES file

Copy link

codecov bot commented Jul 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.38%. Comparing base (9e0ba9a) to head (58f6817).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #252      +/-   ##
==========================================
+ Coverage   95.80%   96.38%   +0.57%     
==========================================
  Files          15       15              
  Lines        1908     1909       +1     
==========================================
+ Hits         1828     1840      +12     
+ Misses         80       69      -11     

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

@wshanks wshanks force-pushed the test-without-numpy branch 3 times, most recently from 328dd5c to 5d72ab7 Compare July 13, 2024 16:52
Given that it is common to work with Uncertainties and numpy, it is easy
to forget to check that a hard dependency on numpy has been introduced.
Here an extra run is added to the CI configuration to run the tests
without installing numpy.
@wshanks
Copy link
Collaborator Author

wshanks commented Jul 13, 2024

Oops, I had meant to open this against my fork first for iterating on the yaml syntax. It looks like it is good now.

At first, I experimented with adding a --skip-numpy option to pytest and marking all the numpy dependent tests so they would show up as skipped, but pytest tries to import all the test files as part of its collection so for this to work a lot of numpy related imports had to be put in try blocks. I didn't like how that would make numpy installation problems show up instead as "variable numpy is undefined" so I went with this simpler variant of just ignoring entirely the files that import numpy (and skipping on test in test_uncertainties that tries to import numpy).

@andrewgsavage
Copy link
Contributor

nice this will be helpful!

@wshanks wshanks merged commit 4a470e4 into lmfit:master Jul 13, 2024
20 checks passed
@wshanks wshanks deleted the test-without-numpy branch July 13, 2024 20:04
@wshanks
Copy link
Collaborator Author

wshanks commented Jul 13, 2024

I think this one is simple enough to merge without more feedback (it doesn't affect the package itself).

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