Skip to content

Commit

Permalink
Add bokeh tests to CI (#194)
Browse files Browse the repository at this point in the history
* Add bokeh tests to CI

* Separate debug and numpy-debug CI runs

* Increase image tolerance for bokeh filled renderer tests
  • Loading branch information
ianthomas23 committed Dec 22, 2022
1 parent 830966a commit d58cd77
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
27 changes: 21 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: pre-commit/action@v3.0.0

test:
name: Test ${{ matrix.python-version }} ${{ matrix.os }} ${{ matrix.debug == 1 && 'debug' || '' }}
name: Test ${{ matrix.python-version }} ${{ matrix.os }} ${{ matrix.numpy-debug == 1 && 'numpy-debug' || '' }} ${{ matrix.debug == 1 && 'debug' || '' }}
runs-on: ${{ matrix.os }}

strategy:
Expand All @@ -30,21 +30,31 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
debug: [0]
numpy-debug: [0]
test-image: [1]
include:
# Add debug build and test to matrix.
# Debug build including bokeh tests.
- os: ubuntu-latest
python-version: '3.10'
debug: 1
numpy-debug: 0
test-image: 1
# Test against numpy debug build.
- os: ubuntu-latest
python-version: '3.10'
debug: 0
numpy-debug: 1
test-image: 1
# PyPy only tested on ubuntu for speed, without image tests.
- os: ubuntu-latest
python-version: 'pypy3.8'
debug: 0
numpy-debug: 0
test-image: 0
- os: ubuntu-latest
python-version: 'pypy3.9'
debug: 0
numpy-debug: 0
test-image: 0

steps:
Expand All @@ -58,6 +68,12 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Build and install numpy from sdist with debug asserts enabled
if: matrix.numpy-debug == '1'
shell: bash
run: |
CFLAGS=-UNDEBUG pip install -v --no-binary=numpy numpy
- name: Install contourpy
shell: bash
run: |
Expand All @@ -73,10 +89,9 @@ jobs:
python -m pip install -ve .[test-no-images]
fi
else
echo "Install numpy from sdist with debug asserts enabled"
CFLAGS=-UNDEBUG pip install -v --no-binary=numpy numpy
echo "Install contourpy in debug mode with test dependencies"
CONTOURPY_DEBUG=1 CONTOURPY_CXX11=1 python -m pip install -ve .[test]
chromium --version
echo "Install contourpy in debug mode with test and bokeh dependencies"
CONTOURPY_DEBUG=1 CONTOURPY_CXX11=1 python -m pip install -ve .[bokeh,test]
fi
python -m pip list
Expand Down
5 changes: 4 additions & 1 deletion tests/test_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ def test_renderer_filled(show_text, fill_type, renderer_type):

image_buffer = renderer.save_to_buffer()
suffix = "" if show_text else "_no_text"
compare_images(image_buffer, f"renderer_filled_{renderer_type}{suffix}.png", f"{fill_type}")
compare_images(
image_buffer, f"renderer_filled_{renderer_type}{suffix}.png", f"{fill_type}",
mean_threshold=0.03 if renderer_type == "bokeh" else None,
)


@pytest.mark.image
Expand Down

0 comments on commit d58cd77

Please sign in to comment.