diff --git a/.github/workflows/python-dev.yml b/.github/workflows/python-dev.yml index 09639acafbba1..d0895450df818 100644 --- a/.github/workflows/python-dev.yml +++ b/.github/workflows/python-dev.yml @@ -29,7 +29,7 @@ env: jobs: build: - if: false # Comment this line out to "unfreeze" + #if: false # Comment this line out to "unfreeze" runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -55,13 +55,14 @@ jobs: python-version: '3.11-dev' - name: Install dependencies - shell: bash -el {0} + #shell: bash -el {0} run: | - python3 -m pip install --upgrade pip setuptools wheel - python3 -m pip install -i https://pypi.anaconda.org/scipy-wheels-nightly/simple numpy - python3 -m pip install git+https://github.com/nedbat/coveragepy.git - python3 -m pip install cython python-dateutil pytz hypothesis pytest>=6.2.5 pytest-xdist pytest-cov pytest-asyncio>=0.17 - python3 -m pip list + python -m pip install --upgrade pip setuptools wheel + # pip install -i https://pypi.anaconda.org/scipy-wheels-nightly/simple numpy + python -m pip install git+https://github.com/nedbat/coveragepy.git + python -m pip install git+https://github.com/numpy/numpy.git + python -m pip install cython python-dateutil pytz hypothesis pytest>=6.2.5 pytest-xdist pytest-cov pytest-asyncio + python -m pip list - name: Build Pandas run: | diff --git a/pandas/compat/__init__.py b/pandas/compat/__init__.py index bb4787f07b2f0..5d3a36a902c05 100644 --- a/pandas/compat/__init__.py +++ b/pandas/compat/__init__.py @@ -28,6 +28,7 @@ PY39 = sys.version_info >= (3, 9) PY310 = sys.version_info >= (3, 10) +PY311 = sys.version_info >= (3, 11) PYPY = platform.python_implementation() == "PyPy" IS64 = sys.maxsize > 2**32 diff --git a/pandas/conftest.py b/pandas/conftest.py index dfe8c5f1778d3..4253e15f0bd5c 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -79,6 +79,14 @@ # Import "zoneinfo" could not be resolved (reportMissingImports) import zoneinfo # type: ignore[no-redef] + # Although zoneinfo can be imported in Py39, it is effectively + # "not available" without tzdata/IANA tz data. + # We will set zoneinfo to not found in this case + try: + utc_zoneinfo = zoneinfo.ZoneInfo("UTC") + except zoneinfo.ZoneInfoNotFoundError: + zoneinfo = None + # Until https://github.com/numpy/numpy/issues/19078 is sorted out, just suppress suppress_npdev_promotion_warning = pytest.mark.filterwarnings( "ignore:Promotion of numbers and bools:FutureWarning" diff --git a/pandas/tests/io/parser/common/test_read_errors.py b/pandas/tests/io/parser/common/test_read_errors.py index 47f1052808e0c..57db65b42464b 100644 --- a/pandas/tests/io/parser/common/test_read_errors.py +++ b/pandas/tests/io/parser/common/test_read_errors.py @@ -12,6 +12,7 @@ import numpy as np import pytest +from pandas.compat import PY311 from pandas.errors import ( EmptyDataError, ParserError, @@ -230,7 +231,7 @@ def test_null_byte_char(all_parsers): names = ["a", "b"] parser = all_parsers - if parser.engine == "c": + if parser.engine == "c" or PY311: expected = DataFrame([[np.nan, "foo"]], columns=names) out = parser.read_csv(StringIO(data), names=names) tm.assert_frame_equal(out, expected) diff --git a/pandas/tests/io/parser/test_quoting.py b/pandas/tests/io/parser/test_quoting.py index 456dd049d2f4a..d47d78da0d905 100644 --- a/pandas/tests/io/parser/test_quoting.py +++ b/pandas/tests/io/parser/test_quoting.py @@ -80,7 +80,10 @@ def test_null_quote_char(all_parsers, quoting, quote_char): if quoting != csv.QUOTE_NONE: # Sanity checking. - msg = "quotechar must be set if quoting enabled" + msg = ( + r"(quotechar must be set if quoting enabled|" + r'"quotechar" must be a 1-character string)' + ) with pytest.raises(TypeError, match=msg): parser.read_csv(StringIO(data), **kwargs) diff --git a/pandas/tests/scalar/test_nat.py b/pandas/tests/scalar/test_nat.py index 873103b01f64d..2e7a3ef966a25 100644 --- a/pandas/tests/scalar/test_nat.py +++ b/pandas/tests/scalar/test_nat.py @@ -220,7 +220,7 @@ def test_missing_public_nat_methods(klass, expected): assert missing == expected -def _get_overlap_public_nat_methods(klass, as_tuple=False): +def _get_overlap_public_nat_methods(klass): """ Get overlapping public methods between NaT and another class. @@ -228,8 +228,6 @@ def _get_overlap_public_nat_methods(klass, as_tuple=False): ---------- klass : type The class to compare with NaT - as_tuple : bool, default False - Whether to return a list of tuples of the form (klass, method). Returns ------- @@ -249,9 +247,6 @@ def _get_overlap_public_nat_methods(klass, as_tuple=False): ts_names = dir(Timestamp) overlap = [x for x in overlap if x not in ts_names] - if as_tuple: - overlap = [(klass, method) for method in overlap] - overlap.sort() return overlap @@ -315,30 +310,28 @@ def test_overlap_public_nat_methods(klass, expected): @pytest.mark.parametrize( - "compare", - ( - _get_overlap_public_nat_methods(Timestamp, True) - + _get_overlap_public_nat_methods(Timedelta, True) - ), + "klass", + (Timestamp, Timedelta), ) -def test_nat_doc_strings(compare): +def test_nat_doc_strings(klass): # see gh-17327 # # The docstrings for overlapping methods should match. - klass, method = compare - klass_doc = getattr(klass, method).__doc__ + methods = _get_overlap_public_nat_methods(klass) + for method in methods: + klass_doc = getattr(klass, method).__doc__ - # Ignore differences with Timestamp.isoformat() as they're intentional - if klass == Timestamp and method == "isoformat": - return + # Ignore differences with Timestamp.isoformat() as they're intentional + if klass == Timestamp and method == "isoformat": + return - if method == "to_numpy": - # GH#44460 can return either dt64 or td64 depending on dtype, - # different docstring is intentional - return + if method == "to_numpy": + # GH#44460 can return either dt64 or td64 depending on dtype, + # different docstring is intentional + return - nat_doc = getattr(NaT, method).__doc__ - assert klass_doc == nat_doc + nat_doc = getattr(NaT, method).__doc__ + assert klass_doc == nat_doc _ops = {