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

DM-35901: Add new test case for importing every python file in a package #165

Merged
merged 5 commits into from Jul 7, 2023

Conversation

timj
Copy link
Member

@timj timj commented Jul 6, 2023

Checklist

  • ran Jenkins
  • added a release note for user-visible changes to doc/changes

@codecov
Copy link

codecov bot commented Jul 6, 2023

Codecov Report

Patch coverage: 93.33% and project coverage change: +0.01 🎉

Comparison is base (0060ff1) 93.95% compared to head (cc3ea8d) 93.97%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #165      +/-   ##
==========================================
+ Coverage   93.95%   93.97%   +0.01%     
==========================================
  Files          43       44       +1     
  Lines        2831     2870      +39     
==========================================
+ Hits         2660     2697      +37     
- Misses        171      173       +2     
Impacted Files Coverage Δ
python/lsst/utils/tests.py 78.43% <92.10%> (+1.57%) ⬆️
python/lsst/utils/packages.py 89.89% <100.00%> (ø)
tests/test_import.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

timj added 5 commits July 6, 2023 12:35
There are a couple of other places using %-format but those
are generally cases where it's a bit cleaner to use than an
f-string.
resources.contents() has been deprecated.
We are not required to support python 3.8 and the modern API for
importlib.resources requires either python 3.9 or a dependency
on the importlib_resources package.
try:
doImport(module_name)
except ImportError as e:
raise AssertionError(f"Error importing module {module_name}: {e}") from e
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to test the failing case? Maybe by writing out a junk python file to a temp directory?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not entirely sure how I would catch the failure since I'm not writing the test that is failing, the infrastructure is writing it and attaching it directly to this class.

@timj timj merged commit 40108f4 into main Jul 7, 2023
12 of 13 checks passed
@timj timj deleted the tickets/DM-35901 branch July 7, 2023 17:29
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.

None yet

2 participants