From 7149504401a827cfbe6f011fbca2fc2ec1c94ced Mon Sep 17 00:00:00 2001 From: Linchin Date: Fri, 12 Apr 2024 13:47:58 -0700 Subject: [PATCH 1/4] fix: use np.nan for numpy >= 2.0.0 --- tests/unit/test_dtypes.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/unit/test_dtypes.py b/tests/unit/test_dtypes.py index 6584cee..f2c5593 100644 --- a/tests/unit/test_dtypes.py +++ b/tests/unit/test_dtypes.py @@ -314,7 +314,7 @@ def test__validate_scalar_invalid(dtype): (False, None), (True, None), (True, pd.NaT if pd else None), - (True, np.NaN if pd else None), + (True, "np.nan" if pd else None), (True, 42), ], ) @@ -328,6 +328,13 @@ def test_take(dtype, allow_fill, fill_value): if dtype == "dbdate" else datetime.time(0, 42, 42, 424242) ) + elif fill_value == "np.nan": + expected_fill = pd.NaT + try: + fill_value = np.NaN + except AttributeError: + # `np.NaN` was removed in NumPy 2.0 release. Use `np.nan` instead + fill_value = np.nan else: expected_fill = pd.NaT b = a.take([1, -1, 3], allow_fill=True, fill_value=fill_value) From f3d6f424378a028129a4fb1cd8ac68e2859d6e68 Mon Sep 17 00:00:00 2001 From: Linchin Date: Fri, 12 Apr 2024 15:58:14 -0700 Subject: [PATCH 2/4] merge unittest-prerelease.yml into unittest.yml --- .github/workflows/unittest-prerelease.yml | 32 ----------------------- .github/workflows/unittest.yml | 27 +++++++++++++++++++ owlbot.py | 2 +- 3 files changed, 28 insertions(+), 33 deletions(-) delete mode 100644 .github/workflows/unittest-prerelease.yml diff --git a/.github/workflows/unittest-prerelease.yml b/.github/workflows/unittest-prerelease.yml deleted file mode 100644 index 9d30c75..0000000 --- a/.github/workflows/unittest-prerelease.yml +++ /dev/null @@ -1,32 +0,0 @@ -on: - pull_request: - branches: - - main -name: unittest-prerelease -jobs: - unit-prerelease: - runs-on: ubuntu-latest - strategy: - matrix: - python: ['3.12'] - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python }} - - name: Install nox - run: | - python -m pip install --upgrade setuptools pip wheel - python -m pip install nox - - name: Run unit tests - env: - COVERAGE_FILE: .coverage-prerelease-${{ matrix.python }} - run: | - nox -s unit_prerelease - - name: Upload coverage results - uses: actions/upload-artifact@v4 - with: - name: coverage-artifacts - path: .coverage-${{ matrix.python }} diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index f4a337c..1ec1850 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -31,6 +31,33 @@ jobs: name: coverage-artifact-${{ matrix.python }} path: .coverage-${{ matrix.python }} + unit-prerelease: + runs-on: ubuntu-latest + strategy: + matrix: + python: ['3.12'] + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run unit tests + env: + COVERAGE_FILE: .coverage-prerelease-${{ matrix.python }} + run: | + nox -s unit_prerelease + - name: Upload coverage results + uses: actions/upload-artifact@v4 + with: + name: coverage-artifacts + path: .coverage-${{ matrix.python }} + cover: runs-on: ubuntu-latest needs: diff --git a/owlbot.py b/owlbot.py index d1b3c08..2c0ea58 100644 --- a/owlbot.py +++ b/owlbot.py @@ -34,7 +34,7 @@ "pandas": "https://pandas.pydata.org/pandas-docs/stable/" }, ) -s.move(templated_files, excludes=["docs/multiprocessing.rst", "README.rst"]) +s.move(templated_files, excludes=["docs/multiprocessing.rst", "README.rst", ".github/workflows/unittest.yml"]) # ---------------------------------------------------------------------------- # Fixup files From 027d852198ad39e2bcfff4ee74c44326307d9b3a Mon Sep 17 00:00:00 2001 From: Linchin Date: Fri, 12 Apr 2024 16:02:51 -0700 Subject: [PATCH 3/4] add unit-prerelease to cover's dependencies --- .github/workflows/unittest.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 1ec1850..e1f0c64 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -62,6 +62,7 @@ jobs: runs-on: ubuntu-latest needs: - unit + - unit-prerelease steps: - name: Checkout uses: actions/checkout@v4 From fba360becbd536591486114afb0f9067eaf5746c Mon Sep 17 00:00:00 2001 From: Linchin Date: Fri, 12 Apr 2024 16:16:28 -0700 Subject: [PATCH 4/4] fix coverage file upload --- .github/workflows/unittest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index e1f0c64..89f021e 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -55,8 +55,8 @@ jobs: - name: Upload coverage results uses: actions/upload-artifact@v4 with: - name: coverage-artifacts - path: .coverage-${{ matrix.python }} + name: coverage-artifact-prerelease-${{ matrix.python }} + path: .coverage-prerelease-${{ matrix.python }} cover: runs-on: ubuntu-latest