Skip to content

Commit

Permalink
Release v0.1.8 (#53)
Browse files Browse the repository at this point in the history
* Remove vtk8 handling (#44)

* remove vtk8

* update readme

* remove from ci

* Align CI versions with pyvista CI

* Remove mention from documentation in readme

* Bump pydata-sphinx-theme from 0.12.0 to 0.13.1 (#48)

Bumps [pydata-sphinx-theme](https://github.com/pydata/pydata-sphinx-theme) from 0.12.0 to 0.13.1.
- [Release notes](https://github.com/pydata/pydata-sphinx-theme/releases)
- [Commits](pydata/pydata-sphinx-theme@v0.12.0...v0.13.1)

---
updated-dependencies:
- dependency-name: pydata-sphinx-theme
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump coverage from 7.0.5 to 7.2.1 (#45)

Bumps [coverage](https://github.com/nedbat/coveragepy) from 7.0.5 to 7.2.1.
- [Release notes](https://github.com/nedbat/coveragepy/releases)
- [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst)
- [Commits](nedbat/coveragepy@7.0.5...7.2.1)

---
updated-dependencies:
- dependency-name: coverage
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump coverage from 7.2.1 to 7.2.2 (#52)

Bumps [coverage](https://github.com/nedbat/coveragepy) from 7.2.1 to 7.2.2.
- [Release notes](https://github.com/nedbat/coveragepy/releases)
- [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst)
- [Commits](nedbat/coveragepy@7.2.1...7.2.2)

---
updated-dependencies:
- dependency-name: coverage
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Add downstream tests and guard against leakages across tests (#49)

* Add downstream tests

* fix requirements install

* changes to working directory and software report

* narrow testing scope

* use dev version

* Temporarily use upstream branch

* Bug: guard against leaking verify_image_cache (#51)

* teardown fixture

* Fix teardown

* Teardown on errors

* update verbosity of tests temporarily

* Update ci_cd.yml

Partially remove verbosity

* use addfinalizer

* format

* use tmp branch

* Back to main branch

* Guard against leakages

* revert verbosity

* whitespace

* Update ci_cd.yml

use other branch

* Try latest python

* upload generated_images as artifact

* run upload on failure

* use same ubuntu version

* use main branch again

* Use main branch again

* add test

* bump version to v0.1.8

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
MatthewFlamm and dependabot[bot] authored Mar 19, 2023
1 parent bb04774 commit bb0fda6
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 3 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,40 @@ jobs:
files: |
./**/*.whl
./**/*.tar.gz
downstream:
name: Downstream tests
runs-on: ubuntu-20.04 # matching pyvista
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'

- run: git clone --depth=1 https://github.com/pyvista/pyvista.git --branch main --single-branch

- name: Install pyvista
run: pip install -ve .
working-directory: pyvista
- name: Install pyvista test requirements
run: pip install -v -r requirements_test.txt
working-directory: pyvista
- name: Install pytest-pyvista
run: pip install -ve .
- name: Software Report
run: |
xvfb-run python -c "import pyvista; print(pyvista.Report()); from pyvista import examples; print('User data path:', examples.USER_DATA_PATH)"
which python
pip list
working-directory: pyvista

- name: Unit Testing
run: xvfb-run python -m pytest --fail_extra_image_cache -v --generated_image_dir gen_dir tests/plotting/test_plotting.py
working-directory: pyvista

- name: Upload generated image artifact
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: generated_images
path: pyvista/gen_dir
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ Home = "https://github.com/pyvista/pytest-pyvista"
[project.optional-dependencies]
tests = [
"codecov<2.2.0",
"coverage==7.0.5",
"coverage==7.2.2",
"pytest>=3.5.0",
"pytest-cov==4.0.0",
"numpy<1.24",
]
docs = [
"pydata-sphinx-theme==0.12.0",
"pydata-sphinx-theme==0.13.1",
"sphinx_copybutton==0.5.1",
"sphinx-notfound-page==0.8.3",
]
Expand Down
2 changes: 1 addition & 1 deletion pytest_pyvista/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Pytest-pyvista package"""

__version__ = "0.1.7"
__version__ = "0.1.8"

from .pytest_pyvista import VerifyImageCache
8 changes: 8 additions & 0 deletions pytest_pyvista/pytest_pyvista.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ def __call__(self, plotter):
and self.fail_extra_image_cache
and not self.reset_image_cache
):
# Make sure this doesn't get called again if this plotter doesn't close properly
plotter._before_close_callback = None
raise RuntimeError(f"{image_filename} does not exist in image cache")

if (
Expand All @@ -206,6 +208,8 @@ def __call__(self, plotter):
error = pyvista.compare_images(image_filename, plotter)

if error > allowed_error:
# Make sure this doesn't get called again if this plotter doesn't close properly
plotter._before_close_callback = None
raise RuntimeError(
f"{test_name} Exceeded image regression error of "
f"{allowed_error} with an image error equal to: {error}"
Expand Down Expand Up @@ -241,4 +245,8 @@ def verify_image_cache(request, pytestconfig):
)
pyvista.global_theme.before_close_callback = verify_image_cache

def reset():
pyvista.global_theme.before_close_callback = None

request.addfinalizer(reset)
return verify_image_cache
30 changes: 30 additions & 0 deletions tests/test_pyvista.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,33 @@ def test_imcache(verify_image_cache):
assert not filecmp.cmp(filename, filename_original, shallow=False)
# should pass even if image doesn't match
result.stdout.fnmatch_lines("*[Pp]assed*")


def test_cleanup(testdir):
"""Test cleanup of the `verify_image_cache` fixture."""
make_cached_images(testdir.tmpdir)
testdir.makepyfile(
"""
import pytest
import pyvista as pv
pv.OFF_SCREEN = True
@pytest.fixture()
def cleanup_tester():
yield
assert pv.global_theme.before_close_callback is None
def test_imcache(cleanup_tester, verify_image_cache):
sphere = pv.Sphere()
plotter = pv.Plotter()
plotter.add_mesh(sphere, color="blue")
try:
plotter.show()
except RuntimeError:
# continue so the cleanup is tested
pass
"""
)

result = testdir.runpytest("--fail_extra_image_cache")
result.stdout.fnmatch_lines("*[Pp]assed*")

0 comments on commit bb0fda6

Please sign in to comment.