Skip to content

Commit 82827b3

Browse files
committed
Merge branch 'ci-xdist' into 'develop'
use pytest-xdist in tests See merge request psyplot/psy-simple!37
2 parents b28eb82 + 94e86d0 commit 82827b3

4 files changed

Lines changed: 17 additions & 8 deletions

File tree

.gitlab-ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@ test:
3636
# container runs as root
3737
# https://doc.qt.io/qt-5/qtwebengine-platform-notes.html#sandboxing-support
3838
QTWEBENGINE_DISABLE_SANDBOX: "true"
39+
tags:
40+
- performance
3941
script:
4042
# install necessary libraries for pyqt
4143
- apt-get install -y xvfb python3-pyqt5.qtwebengine
4244
- pip install pipenv
4345
- pipenv install
44-
- xvfb-run make pipenv-test
46+
- NPROCS=auto xvfb-run make pipenv-test
4547
parallel:
4648
matrix:
4749
- SCENARIO:

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ export PRINT_HELP_PYSCRIPT
2727

2828
BROWSER := python -c "$$BROWSER_PYSCRIPT"
2929

30+
NPROCS ?= 1
31+
3032
help:
3133
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
3234

@@ -79,7 +81,7 @@ pipenv-test: ## run tox
7981
pipenv run black --line-length 79 --check psy_simple
8082
pipenv run flake8 psy_simple
8183
pipenv run pytest -v --cov=psy_simple -x --ref
82-
pipenv run pytest -v --cov=psy_simple -x --cov-append
84+
pipenv run pytest -v --cov=psy_simple -x --cov-append -n $(NPROCS)
8385
pipenv run reuse lint
8486
pipenv run cffconvert --validate
8587

psy_simple/plotters.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2977,7 +2977,8 @@ def array(self):
29772977
xcoord = self.transpose.get_x(self.data)
29782978
func = "get_x" if not self.transpose.value else "get_y"
29792979
data = next(self.iter_data)
2980-
if xcoord.name == getattr(self.decoder, func)(data).name:
2980+
decoder_coord = getattr(self.decoder, func)(data)
2981+
if decoder_coord is not None and xcoord.name == decoder_coord.name:
29812982
bounds = self.decoder.get_cell_node_coord(
29822983
data, axis="x", coords=data.coords
29832984
)
@@ -2996,7 +2997,8 @@ def array(self):
29962997
ycoord = self.transpose.get_y(self.data)
29972998
func = "get_x" if self.transpose.value else "get_y"
29982999
data = next(self.iter_data)
2999-
if ycoord.name == getattr(self.decoder, func)(data).name:
3000+
decoder_coord = getattr(self.decoder, func)(data)
3001+
if decoder_coord is not None and ycoord.name == decoder_coord.name:
30003002
bounds = self.decoder.get_cell_node_coord(
30013003
data, axis="y", coords=data.coords
30023004
)
@@ -4757,9 +4759,11 @@ def update_axis(self, value):
47574759
label_positions = dict(
47584760
zip(
47594761
map("label{}".format, posnames),
4760-
[True, False]
4761-
if self.position in ["t", "ft", "l", "fl"]
4762-
else [False, True],
4762+
(
4763+
[True, False]
4764+
if self.position in ["t", "ft", "l", "fl"]
4765+
else [False, True]
4766+
),
47634767
)
47644768
)
47654769
label_positions.update(**value)
@@ -5883,7 +5887,7 @@ class PointDensity(Formatoption):
58835887
58845888
References
58855889
----------
5886-
.. [statsmodels] http://statsmodels.sourceforge.net/
5890+
.. [statsmodels] https://www.statsmodels.org
58875891
"""
58885892

58895893
priority = START

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ testsite = [
7575
"pytest-cov",
7676
"reuse",
7777
"cffconvert",
78+
"pytest-xdist",
7879
"dask",
7980
"netCDF4",
8081
"seaborn",

0 commit comments

Comments
 (0)