Skip to content

Commit

Permalink
CI: Fix weekly tests again
Browse files Browse the repository at this point in the history
  • Loading branch information
has2k1 committed Oct 17, 2024
1 parent 7cf1a6f commit 6cc67c1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 30 deletions.
39 changes: 12 additions & 27 deletions .github/workflows/weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- cron: "40 06 * * SAT"

jobs:
latest p9, latest matplotlib:
latest-p9_latest-matplotlib:
runs-on: ubuntu-latest

strategy:
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
path: result_images/
if-no-files-found: ignore

latest p9, latest pandas:
latest-p9_latest-pandas:
runs-on: ubuntu-latest

strategy:
Expand All @@ -77,19 +77,16 @@ jobs:
run: echo "UV_SYSTEM_PYTHON=true" >> $GITHUB_ENV

- name: Install Packages
shell: bash
run: |
uv pip install --upgrade git+https://github.com/pandas-dev/pandas
uv pip install ".[extra,test]"
uv pip install --upgrade git+https://github.com/pandas-dev/pandas
- name: Environment Information
shell: bash
run: |
uv pip list
# to do: think about catching deprecations earlier
- name: Run Tests
shell: bash
run: |
make test
Expand All @@ -100,7 +97,7 @@ jobs:
path: result_images/
if-no-files-found: ignore

stable p9, latest matplotlib:
stable-p9_latest-matplotlib:
runs-on: ubuntu-latest

strategy:
Expand All @@ -110,12 +107,10 @@ jobs:
steps:
- name: Get latest release with tag from GitHub API
id: latestrelease
shell: bash
run: |
echo "::set-output name=releasetag::$(curl -s https://api.github.com/repos/has2k1/plotnine/releases/latest | jq '.tag_name' | sed 's/\"//g')"
- name: Confirm Release Tag
shell: bash
run: |
echo ${{ steps.latestrelease.outputs.latestrelease }}
Expand All @@ -138,18 +133,15 @@ jobs:
run: echo "UV_SYSTEM_PYTHON=true" >> $GITHUB_ENV

- name: Install Packages
shell: bash
run: |
uv pip install --upgrade git+https://github.com/matplotlib/matplotlib
uv pip install ".[extra,test]"
- name: Environment Information
shell: bash
run: |
uv pip list
- name: Run Tests
shell: bash
run: |
make test
Expand All @@ -160,7 +152,7 @@ jobs:
path: result_images/
if-no-files-found: ignore

stable p9, latest pandas:
stable-p9_latest-pandas:
runs-on: ubuntu-latest

strategy:
Expand All @@ -170,12 +162,10 @@ jobs:
steps:
- name: Get latest release with tag from GitHub API
id: latestrelease
shell: bash
run: |
echo "::set-output name=releasetag::$(curl -s https://api.github.com/repos/has2k1/plotnine/releases/latest | jq '.tag_name' | sed 's/\"//g')"
- name: Confirm Release Tag
shell: bash
run: |
echo ${{ steps.latestrelease.outputs.latestrelease }}
Expand All @@ -198,19 +188,16 @@ jobs:
run: echo "UV_SYSTEM_PYTHON=true" >> $GITHUB_ENV

- name: Install Packages
shell: bash
run: |
uv pip install --upgrade git+https://github.com/pandas-dev/pandas
uv pip install ".[extra,test]"
- name: Environment Information
shell: bash
run: |
uv pip list
# to do: think about catching deprecations earlier
- name: Run Tests
shell: bash
run: |
make test
Expand All @@ -221,7 +208,9 @@ jobs:
path: tests/result_images/
if-no-files-found: ignore

TYP latest p9, latest matplotlib:
# Should mark this as can fail when feature is implemented
# https://github.com/actions/runner/issues/2347
TYP_latest-p9_latest-matplotlib:
runs-on: ubuntu-latest

strategy:
Expand All @@ -246,22 +235,21 @@ jobs:
run: echo "UV_SYSTEM_PYTHON=true" >> $GITHUB_ENV

- name: Install Packages
shell: bash
run: |
uv pip install ".[extra,typing]"
uv pip install --upgrade git+https://github.com/matplotlib/matplotlib
- name: Environment Information
shell: bash
run: |
uv pip list
- name: Run Tests
shell: bash
run: |
make typecheck
TYP latest p9, latest pandas:
# Should mark this as can fail when feature is implemented
# https://github.com/actions/runner/issues/2347
TYP_latest-p9_latest-pandas:
runs-on: ubuntu-latest

strategy:
Expand All @@ -286,21 +274,18 @@ jobs:
run: echo "UV_SYSTEM_PYTHON=true" >> $GITHUB_ENV

- name: Install Packages
shell: bash
run: |
uv pip install ".[extra,typing]"
uv pip install --upgrade git+https://github.com/pandas-dev/pandas
- name: Environment Information
shell: bash
run: |
uv pip list
# to do: think about catching deprecations earlier
- name: Run Tests
shell: bash
run: |
make test
make typecheck
- uses: actions/upload-artifact@v3
if: failure()
Expand Down
2 changes: 1 addition & 1 deletion plotnine/ggplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ def facet_pages(column)
if verbose:
warn(f"Filename: {filename}", PlotnineWarning)

with PdfPages(filename, keep_empty=False) as pdf:
with PdfPages(filename) as pdf:
# Re-add the first element to the iterator, if it was removed
for plot in plots:
fig = plot.draw()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ dev = [
]

typing = [
"pyright==1.1.374",
"pyright==1.1.385",
"ipython",
"pandas-stubs",
]
Expand Down
6 changes: 5 additions & 1 deletion tests/test_save_as_pdf_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_save_method(self):
with warnings.catch_warnings(record=True) as record:
save_as_pdf_pages(p(), fn, verbose=False)
assert_exist_and_clean(fn, "save method")
assert not record, "Issued an unexpected warning"
assert not record, "Unexpected warnings"

res = ("filename" in str(item.message).lower() for item in record)
assert not any(res)
Expand Down Expand Up @@ -91,6 +91,10 @@ def test_plot_exception(self):
with pytest.raises(PlotnineError):
save_as_pdf_pages(plots, fn, verbose=False)

# TODO: Remove when MPL>=3.10.0
if fn.exists():
fn.unlink()

assert not fn.exists()


Expand Down

0 comments on commit 6cc67c1

Please sign in to comment.