File tree Expand file tree Collapse file tree 7 files changed +481
-45
lines changed Expand file tree Collapse file tree 7 files changed +481
-45
lines changed Original file line number Diff line number Diff line change @@ -26,10 +26,23 @@ jobs:
26
26
with :
27
27
python-version : " ${{ matrix.python-version }}"
28
28
29
- - name : " Install dependencies in pyproject.toml "
29
+ - name : " Install test and project dependencies "
30
30
run : |
31
+ # Project dependencies from pyproject.toml
32
+ # NOTE: Also builds viscm. How do we avoid this?
31
33
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
33
42
34
43
- name : " Run tests"
35
44
run : " make test"
45
+ env :
46
+ # In Pythons >= 3.10, tests fail with `RuntimeError: Invalid DISPLAY
47
+ # variable`, unless this variable is set:
48
+ MPLBACKEND : " Agg"
Original file line number Diff line number Diff line change 2
2
3
3
Install development dependencies:
4
4
5
- ```
5
+ ``` bash
6
6
conda env create # or `mamba env create`
7
7
```
8
8
9
9
10
10
## Development install
11
11
12
- ```
12
+ ``` bash
13
13
pip install -e .
14
14
```
15
15
16
16
17
17
## Testing the build
18
18
19
- ```
19
+ ``` bash
20
20
rm -rf dist
21
21
python -m build
22
22
pip install dist/* .whl # or `dist/*.tar.gz`
23
23
```
24
24
25
25
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
+ ```
27
36
28
37
This codebase uses [ black] ( https://black.readthedocs.io/en/stable/ ) and
29
38
[ ruff] ( https://github.com/charliermarsh/ruff ) to automatically format and lint the code.
@@ -37,3 +46,17 @@ and then another commit should immediately follow which updates
37
46
` .git-blame-ignore-revs ` . For example:
38
47
[ 1fec42d] ( https://github.com/matplotlib/viscm/pull/64/commits/1fec42d0baf90e00d510efd76cb6006fa0c70dc4 ) ,
39
48
[ 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, GUI tests will be skipped. Install with:
59
+
60
+ ``` bash
61
+ sudo apt install xvfb
62
+ ```
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