-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
CLN: Deduplicate show_versions #26816
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
Conversation
formatting looks nice! |
Codecov Report
@@ Coverage Diff @@
## master #26816 +/- ##
==========================================
- Coverage 91.87% 91.86% -0.01%
==========================================
Files 180 180
Lines 50746 50748 +2
==========================================
- Hits 46623 46622 -1
- Misses 4123 4126 +3
Continue to review full report at Codecov.
|
Got a bit carried away here, sorry.
updated output:
|
pandas/util/_test_decorators.py
Outdated
@@ -140,6 +140,17 @@ def skip_if_no( | |||
) | |||
|
|||
|
|||
def skip_if_installed( |
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.
are u using this?
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 should probably have a basic test like this for all our optional deps. Thoughts?
It can't go in test_pytables.py
since that does an importorskip
at the top of the file.
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.
Alternatively, we could try monkeypatching / mocking the module, and never skipping these tests, but I've never had luck working around Python's import caching.
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.
not sure i understand? we already test all of the optional deps but using them
are you suggesting something else?
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.
are you suggesting something else?
Yeah, testing when that aren't present.
@@ -50,3 +52,11 @@ def test_no_version_raises(): | |||
|
|||
with pytest.raises(ImportError, match="Can't determine .* fakemodule"): | |||
import_optional_dependency(name) | |||
|
|||
|
|||
@td.skip_if_installed("tables") |
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.
in the interest of better coverage, would it not be better to monkeypatch builtins.__import__
as was done in #26685 for tests like this rather than skip?
This comment has been minimized.
This comment has been minimized.
lgtm. merge on green. |
7d85c1b
to
da17f0d
Compare
09adcb7
to
aad77d6
Compare
Apologies for the force push. I've given up on my |
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.
IIRC this had a lot more changes (meaning this actually did the de-duplication of show_versions)
|
||
@td.skip_if_installed("tables") | ||
def test_pytables_raises(): | ||
df = pd.DataFrame({"A": [1, 2]}) |
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.
can you go ahead and create
pandas/tests/io/pytables/test_missing_deps.py and put this there (we need to split test_pytables anyhow)
Sorry, that de-duplication is restored now. |
thanks @TomAugspurger very nice! |
Closes #26814
The old version had special cases for numpy, scipy, and pytz. All those now provide a standard
__version__
. xlrd and xlwt are the only special ones now (__version__
)I messed up the minimum xlwt version in the last PR. I copied openpyxl's rather than xlwt's. That's now fixed.
I prettied up the output format a bit, to align the version numbers. Hope that 's OK.