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

Pass bool instead of int values to pytest.mark.skipif #1398

Merged
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 arviz/tests/base_tests/test_diagnostics_numba.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from .test_diagnostics import data # pylint: disable=unused-import

pytestmark = pytest.mark.skipif( # pylint: disable=invalid-name
(importlib.util.find_spec("numba") is None) & ~running_on_ci(),
(importlib.util.find_spec("numba") is None) and not running_on_ci(),
reason="test requires numba which is not installed",
)

Expand Down
14 changes: 7 additions & 7 deletions arviz/tests/base_tests/test_plot_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
from ..helpers import running_on_ci


# Check if Bokeh is installed
bokeh_installed = importlib.util.find_spec("bokeh") is not None # pylint: disable=invalid-name
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just moved this to the top (it used to be in the middle of the file) and then made all the skipif decorators in this file use the same logical expression as the one on line 310. I chose the expression from that line since it seemed the most obvious and explicit to me, but I'm happy to switch to a different one if the maintainers have a different preference.



@pytest.mark.parametrize(
"value, default, expected",
[
Expand Down Expand Up @@ -200,7 +204,7 @@ def test_filter_plotter_list_warning():


@pytest.mark.skipif(
(importlib.util.find_spec("bokeh") is None) & ~running_on_ci(),
not (bokeh_installed or running_on_ci()),
reason="test requires bokeh which is not installed",
)
def test_bokeh_import():
Expand Down Expand Up @@ -278,7 +282,7 @@ def test_mpl_dealiase_sel_kwargs():


@pytest.mark.skipif(
(importlib.util.find_spec("bokeh") is None) & ~running_on_ci(),
not (bokeh_installed or running_on_ci()),
reason="test requires bokeh which is not installed",
)
def test_bokeh_dealiase_sel_kwargs():
Expand All @@ -302,12 +306,8 @@ def test_bokeh_dealiase_sel_kwargs():
assert res["line_color"] == "red"


# Check if Bokeh is installed
bokeh_installed = importlib.util.find_spec("bokeh") is not None # pylint: disable=invalid-name


@pytest.mark.skipif(
not (bokeh_installed | running_on_ci()),
not (bokeh_installed or running_on_ci()),
reason="test requires bokeh which is not installed",
)
def test_set_bokeh_circular_ticks_labels():
Expand Down
2 changes: 1 addition & 1 deletion arviz/tests/base_tests/test_stats_numba.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from .test_stats import centered_eight, non_centered_eight # pylint: disable=unused-import

pytestmark = pytest.mark.skipif( # pylint: disable=invalid-name
(importlib.util.find_spec("numba") is None) & ~running_on_ci(),
(importlib.util.find_spec("numba") is None) and not running_on_ci(),
reason="test requires numba which is not installed",
)

Expand Down
2 changes: 1 addition & 1 deletion arviz/tests/base_tests/test_utils_numba.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from .test_utils import utils_with_numba_import_fail # pylint: disable=unused-import

pytestmark = pytest.mark.skipif( # pylint: disable=invalid-name
(importlib.util.find_spec("numba") is None) & ~running_on_ci(),
(importlib.util.find_spec("numba") is None) and not running_on_ci(),
reason="test requires numba which is not installed",
)

Expand Down