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

RFC: encapsulate try blocks from on demand imports #3935

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nose_unit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ nologcapture=1
verbosity=2
where=yt
with-timer=1
ignore-files=(test_load_errors.py|test_load_sample.py|test_commons.py|test_ambiguous_fields.py|test_field_access_pytest.py|test_save.py|test_line_annotation_unit.py|test_eps_writer.py|test_registration.py|test_invalid_origin.py|test_outputs_pytest\.py|test_normal_plot_api\.py|test_load_archive\.py|test_stream_particles\.py|test_file_sanitizer\.py|test_version\.py)
ignore-files=(test_load_errors.py|test_load_sample.py|test_commons.py|test_ambiguous_fields.py|test_field_access_pytest.py|test_save.py|test_line_annotation_unit.py|test_eps_writer.py|test_registration.py|test_invalid_origin.py|test_outputs_pytest\.py|test_normal_plot_api\.py|test_load_archive\.py|test_stream_particles\.py|test_file_sanitizer\.py|test_version\.py|\test_on_demand_imports\.py)
exclude-test=yt.frontends.gdf.tests.test_outputs.TestGDF
1 change: 1 addition & 0 deletions tests/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ other_tests:
- "--ignore-files=test_registration.py"
- "--ignore-files=test_invalid_origin.py"
- "--ignore-files=test_load_archive\\.py"
- "--ignore-file=test_on_demand_imports\\.py"
- "--ignore-files=test_outputs_pytest\\.py"
- "--ignore-files=test_normal_plot_api\\.py"
- "--ignore-file=test_file_sanitizer\\.py"
Expand Down
8 changes: 3 additions & 5 deletions yt/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -909,13 +909,11 @@ def requires_module_pytest(*module_names):
from yt.utilities import on_demand_imports as odi

def deco(func):
required_modules = {
name: getattr(odi, f"_{name}")._module for name in module_names
}
missing = [
name
for name, mod in required_modules.items()
if isinstance(mod, odi.NotAModule)
for name in module_names
if not getattr(odi, f"_{name}").__is_available__
for name in module_names
]

# note that order between these two decorators matters
Expand Down
Loading