-
-
Notifications
You must be signed in to change notification settings - Fork 553
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
Test Optional Dependencies #3892
Test Optional Dependencies #3892
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #3892 +/- ##
===========================================
- Coverage 99.60% 99.60% -0.01%
===========================================
Files 259 259
Lines 21273 21268 -5
===========================================
- Hits 21189 21184 -5
Misses 84 84 ☔ View full report in Codecov by Sentry. |
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.
Thanks, @lorenzofavaro – please do not mind the earlier, hasty review that I had put in. This looks good to me barring a few required changes. Some of them, such as those for refining CI can be considered for future PRs, not this one.
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.
This looks great @lorenzofavaro, thank you! Approving from my end with one small comment. If no one has any additional comments, we can merge.
@all-contributors please add @lorenzofavaro for code, tests |
I've put up a pull request to add @lorenzofavaro! 🎉 |
* Remove anytree test * Make pandas required * Add test for optional dependencies * Add test pybamm import * Add test job * Remove comments * Rename job * Change exception type * Filter regex (dev&docs extra) * Clarify docstrings * Clarify error message * Remove test runner * Reformulate docstrings * Update changelog and documentation * Remove test module * Remove workflows * Refactor tests * Set package dynamically * Fix comment * Set conditional dependency --------- Co-authored-by: Eric G. Kratz <[email protected]> Co-authored-by: Agriya Khetarpal <[email protected]>
Description
This PR adds a test module for optional dependencies just for the core version of PyBaMM.
Important changes made:
test_import_optional_dependency
(it's a required dependency, not an optional one).pandas
a required dependency. It is actually installed along withxarray
(currently a required dependency).To verify it:
importlib.metadata('pybamm')
. Since the core version ofpybamm
also installs it, the test to check that it does not contain optional dependencies would fail.TestDependencies.test_optional_dependencies
as implemented, does not use the functionimport_optional_dependency
* and conceptually does not verify that a unit function is working correctly. It is checking that in the core version ofpybamm
we are not installing more dependencies than we expect. Moreover, it does not have to be inside a module with filenametest_*
because it would always be executed in any test session. Please, tell me what you think about this and if you suggest any alternatives.test_on_push.yml
workflow that launch it with just the corepybamm
installation.*If I'm not wrong, we cannot use
import_optional_dependency
because distribution packages extracted fromimportlib.metadata
do not necessarily have a 1:1 mapping with import packages, as per documentation:Fixes #3865
Type of change
Key checklist:
$ pre-commit run
(or$ nox -s pre-commit
)$ python run-tests.py --all
(or$ nox -s tests
)$ python run-tests.py --doctest
(or$ nox -s doctests
)