Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/2.1.x' into auto-backport-of-p…
Browse files Browse the repository at this point in the history
…r-55227-on-2.1.x
  • Loading branch information
MarcoGorelli committed Nov 7, 2023
2 parents 3a56117 + c9854d9 commit 8705602
Show file tree
Hide file tree
Showing 26 changed files with 45 additions and 60 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ jobs:
. ~/virtualenvs/pandas-dev/bin/activate
python -m pip install --no-cache-dir -U pip wheel setuptools meson[ninja]==1.2.1 meson-python==0.13.1
python -m pip install numpy --config-settings=setup-args="-Dallow-noblas=true"
python -m pip install --no-cache-dir versioneer[toml] cython python-dateutil pytz pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-asyncio>=0.17 hypothesis>=6.46.1
python -m pip install --no-cache-dir versioneer[toml] cython python-dateutil pytz pytest>=7.3.2 pytest-xdist>=2.2.0 hypothesis>=6.46.1
python -m pip install --no-cache-dir --no-build-isolation -e .
python -m pip list --no-cache-dir
export PANDAS_CI=1
Expand Down Expand Up @@ -274,7 +274,7 @@ jobs:
/opt/python/cp311-cp311/bin/python -m venv ~/virtualenvs/pandas-dev
. ~/virtualenvs/pandas-dev/bin/activate
python -m pip install --no-cache-dir -U pip wheel setuptools meson-python==0.13.1 meson[ninja]==1.2.1
python -m pip install --no-cache-dir versioneer[toml] cython numpy python-dateutil pytz pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-asyncio>=0.17 hypothesis>=6.46.1
python -m pip install --no-cache-dir versioneer[toml] cython numpy python-dateutil pytz pytest>=7.3.2 pytest-xdist>=2.2.0 hypothesis>=6.46.1
python -m pip install --no-cache-dir --no-build-isolation -e .
python -m pip list --no-cache-dir
Expand Down Expand Up @@ -347,7 +347,7 @@ jobs:
python -m pip install --upgrade pip setuptools wheel meson[ninja]==1.2.1 meson-python==0.13.1
python -m pip install --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy
python -m pip install versioneer[toml]
python -m pip install python-dateutil pytz tzdata cython hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-cov pytest-asyncio>=0.17
python -m pip install python-dateutil pytz tzdata cython hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-cov
python -m pip install -ve . --no-build-isolation --no-index --no-deps
python -m pip list
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ jobs:
shell: pwsh
run: |
$TST_CMD = @"
python -m pip install hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-asyncio>=0.17;
python -m pip install hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0;
python -m pip install `$(Get-Item pandas\wheelhouse\*.whl);
python -c `'import pandas as pd; pd.test(extra_args=[\"`\"--no-strict-data-files`\"\", \"`\"-m not clipboard and not single_cpu and not slow and not network and not db`\"\"])`';
"@
Expand Down
1 change: 0 additions & 1 deletion ci/deps/actions-310.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ dependencies:
- pytest>=7.3.2
- pytest-cov
- pytest-xdist>=2.2.0
- pytest-asyncio>=0.17.0
- pytest-localserver>=0.7.1
- boto3

Expand Down
1 change: 0 additions & 1 deletion ci/deps/actions-311-downstream_compat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ dependencies:
- pytest>=7.3.2
- pytest-cov
- pytest-xdist>=2.2.0
- pytest-asyncio>=0.17.0
- pytest-localserver>=0.7.1
- boto3

Expand Down
1 change: 0 additions & 1 deletion ci/deps/actions-311-numpydev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ dependencies:
# causes an InternalError within pytest
- pytest-xdist>=2.2.0, <3
- hypothesis>=6.46.1
- pytest-asyncio>=0.17.0

# pandas dependencies
- python-dateutil
Expand Down
1 change: 0 additions & 1 deletion ci/deps/actions-311-pyarrownightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ dependencies:
- pytest-cov
- pytest-xdist>=2.2.0
- hypothesis>=6.46.1
- pytest-asyncio>=0.17.0

# required dependencies
- python-dateutil
Expand Down
1 change: 0 additions & 1 deletion ci/deps/actions-311.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ dependencies:
- pytest>=7.3.2
- pytest-cov
- pytest-xdist>=2.2.0
- pytest-asyncio>=0.17.0
- pytest-localserver>=0.7.1
- boto3

Expand Down
1 change: 0 additions & 1 deletion ci/deps/actions-39-minimum_versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ dependencies:
- pytest>=7.3.2
- pytest-cov
- pytest-xdist>=2.2.0
- pytest-asyncio>=0.17.0
- pytest-localserver>=0.7.1
- boto3

Expand Down
1 change: 0 additions & 1 deletion ci/deps/actions-39.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ dependencies:
- pytest>=7.3.2
- pytest-cov
- pytest-xdist>=2.2.0
- pytest-asyncio>=0.17.0
- pytest-localserver>=0.7.1
- boto3

Expand Down
1 change: 0 additions & 1 deletion ci/deps/actions-pypy-39.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ dependencies:
# test dependencies
- pytest>=7.3.2
- pytest-cov
- pytest-asyncio>=0.17.0
- pytest-xdist>=2.2.0
- hypothesis>=6.46.1

Expand Down
1 change: 0 additions & 1 deletion ci/deps/circle-310-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ dependencies:
- pytest>=7.3.2
- pytest-cov
- pytest-xdist>=2.2.0
- pytest-asyncio>=0.17.0
- pytest-localserver>=0.7.1
- boto3

Expand Down
1 change: 0 additions & 1 deletion ci/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ test:
requires:
- pip
- pytest >=7.3.2
- pytest-asyncio >=0.17.0
- pytest-xdist >=2.2.0
- pytest-cov
- hypothesis >=6.46.1
Expand Down
1 change: 0 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ dependencies:
- pytest>=7.3.2
- pytest-cov
- pytest-xdist>=2.2.0
- pytest-asyncio>=0.17.0
- coverage

# required dependencies
Expand Down
7 changes: 2 additions & 5 deletions pandas/tests/arrays/categorical/test_warnings.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import pytest

from pandas.util._test_decorators import async_mark

import pandas._testing as tm


class TestCategoricalWarnings:
@async_mark()
async def test_tab_complete_warning(self, ip):
def test_tab_complete_warning(self, ip):
# https://github.com/pandas-dev/pandas/issues/16409
pytest.importorskip("IPython", minversion="6.0.0")
from IPython.core.completer import provisionalcompleter

code = "import pandas as pd; c = pd.Categorical([])"
await ip.run_code(code)
ip.run_cell(code)

# GH 31324 newer jedi version raises Deprecation warning;
# appears resolved 2021-02-02
Expand Down
8 changes: 2 additions & 6 deletions pandas/tests/frame/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

from pandas._config.config import option_context

from pandas.util._test_decorators import async_mark

import pandas as pd
from pandas import (
DataFrame,
Expand Down Expand Up @@ -288,8 +286,7 @@ def _check_f(base, f):
f = lambda x: x.rename({1: "foo"}, inplace=True)
_check_f(d.copy(), f)

@async_mark()
async def test_tab_complete_warning(self, ip, frame_or_series):
def test_tab_complete_warning(self, ip, frame_or_series):
# GH 16409
pytest.importorskip("IPython", minversion="6.0.0")
from IPython.core.completer import provisionalcompleter
Expand All @@ -299,8 +296,7 @@ async def test_tab_complete_warning(self, ip, frame_or_series):
else:
code = "from pandas import Series; obj = Series(dtype=object)"

await ip.run_code(code)

ip.run_cell(code)
# GH 31324 newer jedi version raises Deprecation warning;
# appears resolved 2021-02-02
with tm.assert_produces_warning(None, raise_on_extra_warnings=False):
Expand Down
6 changes: 2 additions & 4 deletions pandas/tests/indexes/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from pandas.compat import IS64
from pandas.errors import InvalidIndexError
from pandas.util._test_decorators import async_mark

from pandas.core.dtypes.common import (
is_any_real_numeric_dtype,
Expand Down Expand Up @@ -1218,14 +1217,13 @@ def test_cached_properties_not_settable(self):
with pytest.raises(AttributeError, match="Can't set attribute"):
index.is_unique = False

@async_mark()
async def test_tab_complete_warning(self, ip):
def test_tab_complete_warning(self, ip):
# https://github.com/pandas-dev/pandas/issues/16409
pytest.importorskip("IPython", minversion="6.0.0")
from IPython.core.completer import provisionalcompleter

code = "import pandas as pd; idx = pd.Index([1, 2])"
await ip.run_code(code)
ip.run_cell(code)

# GH 31324 newer jedi version raises Deprecation warning;
# appears resolved 2021-02-02
Expand Down
16 changes: 15 additions & 1 deletion pandas/tests/interchange/test_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import pytest

from pandas._libs.tslibs import iNaT
from pandas.compat import (
is_ci_environment,
is_platform_windows,
)
import pandas.util._test_decorators as td

import pandas as pd
Expand Down Expand Up @@ -310,11 +314,21 @@ def test_datetimetzdtype(tz, unit):
tm.assert_frame_equal(df, from_dataframe(df.__dataframe__()))


def test_interchange_from_non_pandas_tz_aware():
def test_interchange_from_non_pandas_tz_aware(request):
# GH 54239, 54287
pa = pytest.importorskip("pyarrow", "11.0.0")
import pyarrow.compute as pc

if is_platform_windows() and is_ci_environment():
mark = pytest.mark.xfail(
raises=pa.ArrowInvalid,
reason=(
"TODO: Set ARROW_TIMEZONE_DATABASE environment variable "
"on CI to path to the tzdata for pyarrow."
),
)
request.node.add_marker(mark)

arr = pa.array([datetime(2020, 1, 1), None, datetime(2020, 1, 2)])
arr = pc.assume_timezone(arr, "Asia/Kathmandu")
table = pa.table({"arr": arr})
Expand Down
8 changes: 6 additions & 2 deletions pandas/tests/io/parser/common/test_common_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ def test_read_csv_local(all_parsers, csv1):

fname = prefix + str(os.path.abspath(csv1))
result = parser.read_csv(fname, index_col=0, parse_dates=True)

# TODO: make unit check more specific
if parser.engine == "pyarrow":
result.index = result.index.as_unit("ns")
expected = DataFrame(
[
[0.980269, 3.685731, -0.364216805298, -1.159738],
Expand Down Expand Up @@ -177,7 +179,9 @@ def test_read_csv_low_memory_no_rows_with_index(all_parsers):
def test_read_csv_dataframe(all_parsers, csv1):
parser = all_parsers
result = parser.read_csv(csv1, index_col=0, parse_dates=True)

# TODO: make unit check more specific
if parser.engine == "pyarrow":
result.index = result.index.as_unit("ns")
expected = DataFrame(
[
[0.980269, 3.685731, -0.364216805298, -1.159738],
Expand Down
8 changes: 7 additions & 1 deletion pandas/tests/io/parser/test_parse_dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,12 +979,15 @@ def test_parse_dates_custom_euro_format(all_parsers, kwargs):
)


def test_parse_tz_aware(all_parsers, request):
def test_parse_tz_aware(all_parsers):
# See gh-1693
parser = all_parsers
data = "Date,x\n2012-06-13T01:39:00Z,0.5"

result = parser.read_csv(StringIO(data), index_col=0, parse_dates=True)
# TODO: make unit check more specific
if parser.engine == "pyarrow":
result.index = result.index.as_unit("ns")
expected = DataFrame(
{"x": [0.5]}, index=Index([Timestamp("2012-06-13 01:39:00+00:00")], name="Date")
)
Expand Down Expand Up @@ -2231,6 +2234,9 @@ def test_parse_dates_arrow_engine(all_parsers):
2000-01-01 00:00:01,1"""

result = parser.read_csv(StringIO(data), parse_dates=["a"])
# TODO: make unit check more specific
if parser.engine == "pyarrow":
result["a"] = result["a"].dt.as_unit("ns")
expected = DataFrame(
{
"a": [
Expand Down
6 changes: 2 additions & 4 deletions pandas/tests/resample/test_resampler_grouper.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import pytest

from pandas.compat import is_platform_windows
from pandas.util._test_decorators import async_mark

import pandas as pd
from pandas import (
Expand All @@ -26,8 +25,7 @@ def test_frame():
)


@async_mark()
async def test_tab_complete_ipython6_warning(ip):
def test_tab_complete_ipython6_warning(ip):
from IPython.core.completer import provisionalcompleter

code = dedent(
Expand All @@ -37,7 +35,7 @@ async def test_tab_complete_ipython6_warning(ip):
rs = s.resample("D")
"""
)
await ip.run_code(code)
ip.run_cell(code)

# GH 31324 newer jedi version raises Deprecation warning;
# appears resolved 2021-02-02
Expand Down
12 changes: 1 addition & 11 deletions pandas/util/_test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ def test_foo():

if TYPE_CHECKING:
from pandas._typing import F

from pandas.compat import (
IS64,
is_platform_windows,
)
from pandas.compat._optional import import_optional_dependency

from pandas.core.computation.expressions import (
NUMEXPR_INSTALLED,
Expand Down Expand Up @@ -214,16 +214,6 @@ def documented_fixture(fixture):
return documented_fixture


def async_mark():
try:
import_optional_dependency("pytest_asyncio")
async_mark = pytest.mark.asyncio
except ImportError:
async_mark = pytest.mark.skip(reason="Missing dependency pytest-asyncio")

return async_mark


def mark_array_manager_not_yet_implemented(request) -> None:
mark = pytest.mark.xfail(reason="Not yet implemented for ArrayManager")
request.node.add_marker(mark)
Expand Down
6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ repository = 'https://github.com/pandas-dev/pandas'
matplotlib = "pandas:plotting._matplotlib"

[project.optional-dependencies]
test = ['hypothesis>=6.46.1', 'pytest>=7.3.2', 'pytest-xdist>=2.2.0', 'pytest-asyncio>=0.17.0']
test = ['hypothesis>=6.46.1', 'pytest>=7.3.2', 'pytest-xdist>=2.2.0']
performance = ['bottleneck>=1.3.4', 'numba>=0.55.2', 'numexpr>=2.8.0']
computation = ['scipy>=1.8.1', 'xarray>=2022.03.0']
fss = ['fsspec>=2022.05.0']
Expand Down Expand Up @@ -109,7 +109,6 @@ all = ['beautifulsoup4>=4.11.1',
'pyreadstat>=1.1.5',
'pytest>=7.3.2',
'pytest-xdist>=2.2.0',
'pytest-asyncio>=0.17.0',
'pyxlsb>=1.0.9',
'qtpy>=2.2.0',
'scipy>=1.8.1',
Expand Down Expand Up @@ -151,7 +150,7 @@ setup = ['--vsenv'] # For Windows
skip = "cp36-* cp37-* cp38-* pp* *_i686 *_ppc64le *_s390x *-musllinux_aarch64"
build-verbosity = "3"
environment = {LDFLAGS="-Wl,--strip-all"}
test-requires = "hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-asyncio>=0.17"
test-requires = "hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0"
test-command = """
PANDAS_CI='1' python -c 'import pandas as pd; \
pd.test(extra_args=["-m not clipboard and not single_cpu and not slow and not network and not db", "-n 2", "--no-strict-data-files"]); \
Expand Down Expand Up @@ -514,7 +513,6 @@ markers = [
"arm_slow: mark a test as slow for arm64 architecture",
"arraymanager: mark a test to run with ArrayManager enabled",
]
asyncio_mode = "strict"

[tool.mypy]
# Import discovery
Expand Down
1 change: 0 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ meson-python==0.13.1
pytest>=7.3.2
pytest-cov
pytest-xdist>=2.2.0
pytest-asyncio>=0.17.0
coverage
python-dateutil
numpy<2
Expand Down
1 change: 0 additions & 1 deletion scripts/tests/data/deps_expected_random.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ dependencies:
- pytest-cov
- pytest-xdist>=2.2.0
- psutil
- pytest-asyncio>=0.17.0
- boto3

# required dependencies
Expand Down
Loading

0 comments on commit 8705602

Please sign in to comment.