Skip to content

Automatic PR for f3b2050d-ffb9-4097-8c8e-44be7ca233e1 #63

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

Open
wants to merge 1 commit into
base: f3b2050d-ffb9-4097-8c8e-44be7ca233e1-base
Choose a base branch
from
Open
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
24 changes: 11 additions & 13 deletions pandas/util/_test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,27 +114,25 @@ def _skip_if_no_scipy() -> bool:
)


def skip_if_installed(package: str) -> pytest.MarkDecorator:
# TODO(pytest#7469): return type, _pytest.mark.structures.MarkDecorator is not public
# https://github.com/pytest-dev/pytest/issues/7469
def skip_if_installed(package: str):
"""
Skip a test if a package is installed.

Parameters
----------
package : str
The name of the package.

Returns
-------
pytest.MarkDecorator
a pytest.mark.skipif to use as either a test decorator or a
parametrization mark.
"""
return pytest.mark.skipif(
safe_import(package), reason=f"Skipping because {package} is installed."
)


def skip_if_no(package: str, min_version: str | None = None) -> pytest.MarkDecorator:
# TODO(pytest#7469): return type, _pytest.mark.structures.MarkDecorator is not public
# https://github.com/pytest-dev/pytest/issues/7469
def skip_if_no(package: str, min_version: str | None = None):
"""
Generic function to help skip tests when required packages are not
present on the testing system.
Expand All @@ -160,7 +158,7 @@ def skip_if_no(package: str, min_version: str | None = None) -> pytest.MarkDecor

Returns
-------
pytest.MarkDecorator
_pytest.mark.structures.MarkDecorator
a pytest.mark.skipif to use as either a test decorator or a
parametrization mark.
"""
Expand Down Expand Up @@ -191,9 +189,9 @@ def skip_if_no(package: str, min_version: str | None = None) -> pytest.MarkDecor
)


def skip_if_np_lt(
ver_str: str, *args, reason: str | None = None
) -> pytest.MarkDecorator:
# TODO(pytest#7469): return type, _pytest.mark.structures.MarkDecorator is not public
# https://github.com/pytest-dev/pytest/issues/7469
def skip_if_np_lt(ver_str: str, *args, reason: str | None = None):
if reason is None:
reason = f"NumPy {ver_str} or greater required"
return pytest.mark.skipif(
Expand Down Expand Up @@ -263,4 +261,4 @@ def mark_array_manager_not_yet_implemented(request) -> None:
skip_copy_on_write_invalid_test = pytest.mark.skipif(
get_option("mode.copy_on_write"),
reason="Test not valid for Copy-on-Write mode",
)
)