Skip to content

Commit

Permalink
test_views_info.py: Skip test if required packages are missing
Browse files Browse the repository at this point in the history
Alternative would be to add .[web] dependencies to .[dev] dependencies.
Noticed because of failing GitHub Action run.

==================================== ERRORS ====================================
__________________ ERROR collecting tests/test_views_info.py ___________________
ImportError while importing test module '/home/runner/work/PatchScope/PatchScope/tests/test_views_info.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
[...]/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_views_info.py:3: in <module>
    from diffinsights_web.views.info import time_range_options
src/diffinsights_web/views/__init__.py:3: in <module>
    import panel as pn
E   ModuleNotFoundError: No module named 'panel'
=========================== short test summary info ============================
  • Loading branch information
jnareb committed Dec 5, 2024
1 parent 51a44db commit e76430c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/test_views_info.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import datetime

# https://docs.pytest.org/en/stable/how-to/skipping.html#skipping-on-a-missing-import-dependency
import pytest
pandas = pytest.importorskip("pandas")
param = pytest.importorskip("param")
panel = pytest.importorskip("panel")

from diffinsights_web.views.info import time_range_options


Expand Down

0 comments on commit e76430c

Please sign in to comment.