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

fix: remove unused hist import in test_0965 #994

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

GaetanLepage
Copy link
Contributor

Test 0965 fails:

==================================== ERRORS ====================================_____ ERROR collecting tests/test_0965-inverted-axes-variances-hist-888.py _____ImportError while importing test module '/build/source/tests/test_0965-inverted-axes-variances-hist-888.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/nix/store/pzf6dnxg8gf04xazzjdwarm7s03cbrgz-python3-3.10.12/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_0965-inverted-axes-variances-hist-888.py:5: in <module>
    import hist
E   ModuleNotFoundError: No module named 'hist'

It seems that the other tests relying on hist import it using hist = pytest.importorskip("hist").
I did the same in this problematic test.

import uproot
import skhep_testdata

hist = pytest.importorskip("hist")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hist is not used in these tests, thus it can be simply removed as an import

Copy link
Member

@jpivarski jpivarski Oct 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
hist = pytest.importorskip("hist")
pytest.importorskip("hist")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait—we do need this import because to_hist is used in the tests. These would fail if hist is not installed. We do need the importorskip, but we don't need to assign it to a variable.

Copy link
Member

@jpivarski jpivarski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this!

I'll merge it when the tests pass.

import uproot
import skhep_testdata

hist = pytest.importorskip("hist")
Copy link
Member

@jpivarski jpivarski Oct 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
hist = pytest.importorskip("hist")
pytest.importorskip("hist")

@GaetanLepage
Copy link
Contributor Author

I removed the import completely.

@GaetanLepage GaetanLepage changed the title fix: make hist import optional in test_0965 fix: remove unused hist import in test_0965 Oct 18, 2023
@jpivarski
Copy link
Member

Okay, now it's in a good state. The lines where there's a hidden dependency on hist (Uproot would raise ModuleNotFoundError suggesting that you install it) are

and

Now that the file has

I'll enable "auto-merge (squash)."

@jpivarski jpivarski enabled auto-merge (squash) October 18, 2023 14:12
@jpivarski
Copy link
Member

@all-contributors please add @GaetanLepage for test

Thanks!

@allcontributors
Copy link
Contributor

@jpivarski

I've put up a pull request to add @GaetanLepage! 🎉

@jpivarski jpivarski merged commit 2bc23dc into scikit-hep:main Oct 18, 2023
lobis added a commit that referenced this pull request Oct 19, 2023
…split

* origin/fsspec-urlsplit:
  feat: add support for current RNTuple files (#962)
  chore: update pre-commit hooks (#993)
  chore: add types to most of the `uproot.source` module (#996)
  fix: make hist import optional in test_0965 (#994)
  docs: add GaetanLepage as a contributor for test (#995)
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.

3 participants