From 4364f6e1d9fe57162842972376df0d8df435b46b Mon Sep 17 00:00:00 2001 From: Matthew Roeschke Date: Fri, 24 Dec 2021 14:31:47 -0800 Subject: [PATCH 1/6] CI: Merge database workflow into posix workflow --- .github/workflows/database.yml | 123 --------------------------------- .github/workflows/posix.yml | 30 ++++++++ 2 files changed, 30 insertions(+), 123 deletions(-) delete mode 100644 .github/workflows/database.yml diff --git a/.github/workflows/database.yml b/.github/workflows/database.yml deleted file mode 100644 index 294091ec9852e..0000000000000 --- a/.github/workflows/database.yml +++ /dev/null @@ -1,123 +0,0 @@ -name: Database - -on: - push: - branches: - - master - - 1.3.x - pull_request: - branches: - - master - - 1.3.x - paths-ignore: - - "doc/**" - -env: - PYTEST_WORKERS: "auto" - PANDAS_CI: 1 - PATTERN: ((not slow and not network and not clipboard) or (single and db)) - COVERAGE: true - -jobs: - Linux_py38_IO: - runs-on: ubuntu-latest - defaults: - run: - shell: bash -l {0} - - strategy: - matrix: - ENV_FILE: [ci/deps/actions-38-db-min.yaml, ci/deps/actions-38-db.yaml] - fail-fast: false - - concurrency: - # https://github.community/t/concurrecy-not-work-for-push/183068/7 - group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-${{ matrix.ENV_FILE }} - cancel-in-progress: true - - services: - mysql: - image: mysql - env: - MYSQL_ALLOW_EMPTY_PASSWORD: yes - MYSQL_DATABASE: pandas - options: >- - --health-cmd "mysqladmin ping" - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 3306:3306 - - postgres: - image: postgres - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DB: pandas - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 5432:5432 - - moto: - image: motoserver/moto - env: - AWS_ACCESS_KEY_ID: foobar_key - AWS_SECRET_ACCESS_KEY: foobar_secret - ports: - - 5000:5000 - - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Cache conda - uses: actions/cache@v2 - env: - CACHE_NUMBER: 0 - with: - path: ~/conda_pkgs_dir - key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ - hashFiles('${{ matrix.ENV_FILE }}') }} - - - uses: conda-incubator/setup-miniconda@v2 - with: - mamba-version: "*" - channels: conda-forge - activate-environment: pandas-dev - channel-priority: strict - environment-file: ${{ matrix.ENV_FILE }} - use-only-tar-bz2: true - - - name: Build Pandas - uses: ./.github/actions/build_pandas - - - name: Test - run: pytest -m "${{ env.PATTERN }}" -n 2 --dist=loadfile --cov=pandas --cov-report=xml pandas/tests/io - if: always() - - - name: Build Version - run: pushd /tmp && python -c "import pandas; pandas.show_versions();" && popd - - - name: Publish test results - uses: actions/upload-artifact@master - with: - name: Test results - path: test-data.xml - if: failure() - - - name: Print skipped tests - run: python ci/print_skipped.py - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 - with: - flags: unittests - name: codecov-pandas - fail_ci_if_error: true diff --git a/.github/workflows/posix.yml b/.github/workflows/posix.yml index 3fa9341bd0fef..5d7cdb8c416cc 100644 --- a/.github/workflows/posix.yml +++ b/.github/workflows/posix.yml @@ -25,6 +25,8 @@ jobs: strategy: matrix: settings: [ + [actions-38-db-min.yaml, "((not slow and not network and not clipboard) or (single and db))", "", "", "", "", ""], + [actions-38-db.yaml, "((not slow and not network and not clipboard) or (single and db))", "", "", "", "", ""] [actions-38-minimum_versions.yaml, "not slow and not network and not clipboard", "", "", "", "", ""], [actions-38-locale_slow.yaml, "slow", "language-pack-it xsel", "it_IT.utf8", "it_IT.utf8", "", ""], [actions-38.yaml, "not slow and not clipboard", "", "", "", "", ""], @@ -52,7 +54,35 @@ jobs: # https://github.community/t/concurrecy-not-work-for-push/183068/7 group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-${{ matrix.settings[0] }} cancel-in-progress: true + services: + mysql: + image: mysql + env: + MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_DATABASE: pandas + options: >- + --health-cmd "mysqladmin ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 3306:3306 + + postgres: + image: postgres + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: pandas + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 + moto: image: motoserver/moto env: From 2c4a0f489dbacfa2a57721126b30cf46eaecd180 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke Date: Fri, 24 Dec 2021 17:17:53 -0800 Subject: [PATCH 2/6] Add missing comma --- .github/workflows/posix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/posix.yml b/.github/workflows/posix.yml index 5d7cdb8c416cc..2a40be680c681 100644 --- a/.github/workflows/posix.yml +++ b/.github/workflows/posix.yml @@ -26,7 +26,7 @@ jobs: matrix: settings: [ [actions-38-db-min.yaml, "((not slow and not network and not clipboard) or (single and db))", "", "", "", "", ""], - [actions-38-db.yaml, "((not slow and not network and not clipboard) or (single and db))", "", "", "", "", ""] + [actions-38-db.yaml, "((not slow and not network and not clipboard) or (single and db))", "", "", "", "", ""], [actions-38-minimum_versions.yaml, "not slow and not network and not clipboard", "", "", "", "", ""], [actions-38-locale_slow.yaml, "slow", "language-pack-it xsel", "it_IT.utf8", "it_IT.utf8", "", ""], [actions-38.yaml, "not slow and not clipboard", "", "", "", "", ""], From 6897bd44ee23211da3450b5979cf38b43ea0bd3f Mon Sep 17 00:00:00 2001 From: Matthew Roeschke Date: Fri, 24 Dec 2021 21:35:59 -0800 Subject: [PATCH 3/6] Fix numpy compat condidtion in test_floating_array_disallows_float16 --- pandas/tests/arrays/floating/test_construction.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/tests/arrays/floating/test_construction.py b/pandas/tests/arrays/floating/test_construction.py index 169b23c31f863..6fa3744429e5d 100644 --- a/pandas/tests/arrays/floating/test_construction.py +++ b/pandas/tests/arrays/floating/test_construction.py @@ -5,7 +5,7 @@ from pandas.compat import ( is_platform_windows, - np_version_under1p19, + np_version_under1p20, ) import pandas as pd @@ -56,7 +56,7 @@ def test_floating_array_disallows_float16(request): with pytest.raises(TypeError, match=msg): FloatingArray(arr, mask) - if np_version_under1p19 or ( + if np_version_under1p20 or ( locale.getlocale()[0] != "en_US" and not is_platform_windows() ): # the locale condition may need to be refined; this fails on From 1c67b22d8bf3fd88cddeae4d3145be6863bafc9a Mon Sep 17 00:00:00 2001 From: Matthew Roeschke Date: Sat, 25 Dec 2021 11:44:16 -0800 Subject: [PATCH 4/6] Fix test for psycopg2.9 change --- pandas/tests/tools/test_to_datetime.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pandas/tests/tools/test_to_datetime.py b/pandas/tests/tools/test_to_datetime.py index 013af7eb90cd3..0a95e394e99d8 100644 --- a/pandas/tests/tools/test_to_datetime.py +++ b/pandas/tests/tools/test_to_datetime.py @@ -44,6 +44,7 @@ from pandas.core.arrays import DatetimeArray from pandas.core.tools import datetimes as tools from pandas.core.tools.datetimes import start_caching_at +from pandas.util.version import Version @pytest.fixture(params=[True, False]) @@ -810,11 +811,20 @@ def test_to_datetime_utc_true_with_series_datetime_ns(self, cache, date, dtype): tm.assert_series_equal(result, expected) @td.skip_if_no("psycopg2") - def test_to_datetime_tz_psycopg2(self, cache): + def test_to_datetime_tz_psycopg2(self, request, cache): # xref 8260 import psycopg2 + if Version(psycopg2.__version__) > Version("2.8.7"): + # https://www.psycopg.org/docs/news.html#what-s-new-in-psycopg-2-9 + request.node.add_marker( + pytest.mark.xfail( + raises=AttributeError, + reason="psycopg2.tz is deprecated (and appears dropped) in 2.9", + ) + ) + # misc cases tz1 = psycopg2.tz.FixedOffsetTimezone(offset=-300, name=None) tz2 = psycopg2.tz.FixedOffsetTimezone(offset=-240, name=None) From 18afb6b1a8c5ef29f9df7f1548938512989974b6 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke Date: Sat, 25 Dec 2021 11:47:29 -0800 Subject: [PATCH 5/6] Just add the condition in the xfail --- pandas/tests/tools/test_to_datetime.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pandas/tests/tools/test_to_datetime.py b/pandas/tests/tools/test_to_datetime.py index 0a95e394e99d8..de55cdc142fd5 100644 --- a/pandas/tests/tools/test_to_datetime.py +++ b/pandas/tests/tools/test_to_datetime.py @@ -816,14 +816,14 @@ def test_to_datetime_tz_psycopg2(self, request, cache): # xref 8260 import psycopg2 - if Version(psycopg2.__version__) > Version("2.8.7"): - # https://www.psycopg.org/docs/news.html#what-s-new-in-psycopg-2-9 - request.node.add_marker( - pytest.mark.xfail( - raises=AttributeError, - reason="psycopg2.tz is deprecated (and appears dropped) in 2.9", - ) + # https://www.psycopg.org/docs/news.html#what-s-new-in-psycopg-2-9 + request.node.add_marker( + pytest.mark.xfail( + Version(psycopg2.__version__) > Version("2.8.7"), + raises=AttributeError, + reason="psycopg2.tz is deprecated (and appears dropped) in 2.9", ) + ) # misc cases tz1 = psycopg2.tz.FixedOffsetTimezone(offset=-300, name=None) From e11d65ebc085cd726798d6ee060e55d9dd16f149 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke Date: Sat, 25 Dec 2021 17:48:05 -0800 Subject: [PATCH 6/6] Split psycopg2 version due to odd format --- pandas/tests/tools/test_to_datetime.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/tools/test_to_datetime.py b/pandas/tests/tools/test_to_datetime.py index de55cdc142fd5..cc1917933ee6e 100644 --- a/pandas/tests/tools/test_to_datetime.py +++ b/pandas/tests/tools/test_to_datetime.py @@ -819,7 +819,7 @@ def test_to_datetime_tz_psycopg2(self, request, cache): # https://www.psycopg.org/docs/news.html#what-s-new-in-psycopg-2-9 request.node.add_marker( pytest.mark.xfail( - Version(psycopg2.__version__) > Version("2.8.7"), + Version(psycopg2.__version__.split()[0]) > Version("2.8.7"), raises=AttributeError, reason="psycopg2.tz is deprecated (and appears dropped) in 2.9", )