diff --git a/tests/__init__.py b/tests/__init__.py index 551ef44f4..e9868db14 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -136,3 +136,21 @@ def pytest_warns_bounded( return nullcontext() else: return suppress(upper_exception) + + +def nigthly_test_skip( + # skip_func: str, + reason_to_skip: str, + lower: str | None = None, + upper: str | None = None, + version_no: str | None = None, +) -> AbstractContextManager: + lb = Version("0.0.0") if lower is None else Version(lower) + ub = Version("9999.0.0") if upper is None else Version(upper) + if version_no is None: + current = Version(pd.__version__) + else: + current = Version(version_no) + if lb < current < ub: + # if skip_func: + return pytest.mark.skipif(reason=reason_to_skip) diff --git a/tests/test_frame.py b/tests/test_frame.py index c2e4ef4f7..1227f547d 100644 --- a/tests/test_frame.py +++ b/tests/test_frame.py @@ -41,6 +41,7 @@ PD_LTE_15, TYPE_CHECKING_INVALID_USAGE, check, + nigthly_test_skip, pytest_warns_bounded, ) @@ -1437,6 +1438,9 @@ def test_types_regressions() -> None: ) +@nigthly_test_skip( + reason_to_skip="not compatible with newer versions", version_no="1.5.0" +) def test_read_csv() -> None: with ensure_clean() as path: Path(path).write_text("A,B\n1,2") diff --git a/tests/test_pandas.py b/tests/test_pandas.py index a605e80c3..4e2bd4495 100644 --- a/tests/test_pandas.py +++ b/tests/test_pandas.py @@ -24,10 +24,14 @@ PD_LTE_15, TYPE_CHECKING_INVALID_USAGE, check, + nigthly_test_skip, pytest_warns_bounded, ) +@nigthly_test_skip( + reason_to_skip="not compatiblw with newer versions", version_no="1.5.0" +) def test_types_to_datetime() -> None: df = pd.DataFrame({"year": [2015, 2016], "month": [2, 3], "day": [4, 5]}) r1: pd.Series = pd.to_datetime(df) diff --git a/tests/test_scalars.py b/tests/test_scalars.py index 48c21e7c9..10f19ba70 100644 --- a/tests/test_scalars.py +++ b/tests/test_scalars.py @@ -28,6 +28,7 @@ from tests import ( TYPE_CHECKING_INVALID_USAGE, check, + nigthly_test_skip, pytest_warns_bounded, ) @@ -1734,6 +1735,9 @@ def test_period_properties() -> None: check(assert_type(p2.freq, BaseOffset), Day) +@nigthly_test_skip( + reason_to_skip="Not compatible with newer version", version_no="1.5.0" +) def test_period_add_subtract() -> None: p = pd.Period("2012-1-1", freq="D") diff --git a/tests/test_timefuncs.py b/tests/test_timefuncs.py index 91c1be634..87b7147c8 100644 --- a/tests/test_timefuncs.py +++ b/tests/test_timefuncs.py @@ -30,6 +30,7 @@ from tests import ( TYPE_CHECKING_INVALID_USAGE, check, + nigthly_test_skip, ) from pandas.tseries.holiday import USFederalHolidayCalendar @@ -290,6 +291,9 @@ def test_comparisons_datetimeindex() -> None: check(assert_type((dti != ts), np_ndarray_bool), np.ndarray) +@nigthly_test_skip( + reason_to_skip="not compatible with newer versions", version_no="1.5.0" +) def test_to_datetime_nat() -> None: # GH 88 check(