File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,10 +26,19 @@ jobs:
2626 with :
2727 python-version : " ${{ matrix.python-version }}"
2828
29- - name : " Install dependencies in pyproject.toml "
29+ - name : " Install test and project dependencies "
3030 run : |
31+ # Project dependencies from pyproject.toml
32+ # NOTE: Also builds viscm. How do we avoid this?
3133 pip install .
32- pip install pytest pytest-cov ${{ matrix.pyqt-dependency }}
34+
35+ # Test dependencies
36+ pip install pytest pytest-cov pytest-qt pytest-xvfb ${{ matrix.pyqt-dependency }}
37+ # pytest-qt CI dependencies: https://pytest-qt.readthedocs.io/en/latest/troubleshooting.html#github-actions
38+ sudo apt update
39+ sudo apt install -y \
40+ xvfb \
41+ libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 x11-utils
3342
3443 - name : " Run tests"
3544 run : " make test"
Original file line number Diff line number Diff line change 11.PHONY : test
22test :
33 python -m pytest --version
4- python -m pytest -v test/
4+ python -m pytest --xvfb-backend=xvfb - v test/
55
66
77.PHONY : lint
Original file line number Diff line number Diff line change 22
33Install development dependencies:
44
5- ```
5+ ``` bash
66conda env create # or `mamba env create`
77```
88
99
1010## Development install
1111
12- ```
12+ ``` bash
1313pip install -e .
1414```
1515
1616
1717## Testing the build
1818
19- ```
19+ ``` bash
2020rm -rf dist
2121python -m build
2222pip install dist/* .whl # or `dist/*.tar.gz`
2323```
2424
2525
26- ## Code formatting and linting
26+ ## Tests
27+
28+ See ` Makefile ` for convenience commands.
29+
30+
31+ ### Code linting (and formatting)
32+
33+ ``` bash
34+ make lint
35+ ```
2736
2837This codebase uses [ black] ( https://black.readthedocs.io/en/stable/ ) and
2938[ ruff] ( https://github.com/charliermarsh/ruff ) to automatically format and lint the code.
@@ -37,3 +46,18 @@ and then another commit should immediately follow which updates
3746` .git-blame-ignore-revs ` . For example:
3847[ 1fec42d] ( https://github.com/matplotlib/viscm/pull/64/commits/1fec42d0baf90e00d510efd76cb6006fa0c70dc4 ) ,
3948[ 8aa7bb0] ( https://github.com/matplotlib/viscm/pull/64/commits/8aa7bb01440aeca6f8bbcefe0671c28f2ce284c6 ) .
49+
50+
51+ ### Unit tests
52+
53+ ``` bash
54+ make test
55+ ```
56+
57+ Unit tests require ` xvfb ` (X Virtual Framebuffer) to test the GUI. If ` xvfb ` is not
58+ installed, you'll receive ` ERROR: xvfb backend xvfb requested but not installed ` .
59+ Install with:
60+
61+ ``` bash
62+ sudo apt install xvfb
63+ ```
Original file line number Diff line number Diff line change 1+ from pathlib import Path
2+
3+ import pytest
4+
5+
6+ @pytest .fixture
7+ def tests_data_dir () -> Path :
8+ tests_dir = Path (__file__ ).parent .resolve ()
9+ tests_data_dir = tests_dir / "data"
10+ return tests_data_dir
You can’t perform that action at this time.
0 commit comments