Skip to content

Commit 0577393

Browse files
CI: remove unneeded install of graphviz on ubuntu (#515)
Co-authored-by: Tobias Raabe <[email protected]>
1 parent 4b613df commit 0577393

File tree

5 files changed

+25
-25
lines changed

5 files changed

+25
-25
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
allow-prereleases: true
3939
- run: pip install tox
4040

41-
- if: matrix.os == 'ubunut-latest'
41+
- if: matrix.os == 'ubuntu-latest'
4242
run: |
4343
sudo apt-get update
4444
sudo apt-get install graphviz graphviz-dev

docs/source/changes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ chronological order. Releases follow [semantic versioning](https://semver.org/)
55
releases are available on [PyPI](https://pypi.org/project/pytask) and
66
[Anaconda.org](https://anaconda.org/conda-forge/pytask).
77

8+
## 0.4.5 - 2023-12-xx
9+
10+
- {pull}`515` enables tests with graphviz in CI. Thanks to {user}`NickCrews`.
11+
812
## 0.4.4 - 2023-12-04
913

1014
- {pull}`509` improves the documentation.

pyproject.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,14 @@ docs = [
6969
"sphinx-toolbox",
7070
"sphinxext-opengraph",
7171
]
72-
test = ["pytest", "pytest-cov", "pytest-xdist", "syrupy", "deepdiff", "pexpect"]
72+
test = [
73+
"deepdiff",
74+
"pexpect",
75+
"pytest",
76+
"pytest-cov",
77+
"pytest-xdist",
78+
"syrupy",
79+
]
7380

7481
[project.urls]
7582
Changelog = "https://pytask-dev.readthedocs.io/en/stable/changes.html"

tests/test_dag_command.py

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
import shutil
3+
import os
44
import sys
55
import textwrap
66

@@ -16,26 +16,18 @@
1616
else:
1717
_IS_PYGRAPHVIZ_INSTALLED = True
1818

19+
# Test should run always on remote except on Windows and locally only with the package
20+
# installed.
21+
_TEST_SHOULD_RUN = _IS_PYGRAPHVIZ_INSTALLED or (
22+
os.environ.get("CI") and sys.platform != "win32"
23+
)
1924
_GRAPH_LAYOUTS = ["neato", "dot", "fdp", "sfdp", "twopi", "circo"]
20-
21-
22-
_PARAMETRIZED_LAYOUTS = [
23-
pytest.param(
24-
layout,
25-
marks=pytest.mark.skip(reason=f"{layout} not available")
26-
if shutil.which(layout) is None
27-
else [],
28-
)
29-
for layout in _GRAPH_LAYOUTS
30-
]
31-
32-
3325
_TEST_FORMATS = ["dot", "pdf", "png", "jpeg", "svg"]
3426

3527

3628
@pytest.mark.end_to_end()
37-
@pytest.mark.skipif(not _IS_PYGRAPHVIZ_INSTALLED, reason="pygraphviz is required")
38-
@pytest.mark.parametrize("layout", _PARAMETRIZED_LAYOUTS)
29+
@pytest.mark.skipif(not _TEST_SHOULD_RUN, reason="pygraphviz is required")
30+
@pytest.mark.parametrize("layout", _GRAPH_LAYOUTS)
3931
@pytest.mark.parametrize("format_", _TEST_FORMATS)
4032
@pytest.mark.parametrize("rankdir", ["LR"])
4133
def test_create_graph_via_cli(tmp_path, runner, format_, layout, rankdir):
@@ -70,8 +62,8 @@ def task_example(): pass
7062

7163

7264
@pytest.mark.end_to_end()
73-
@pytest.mark.skipif(not _IS_PYGRAPHVIZ_INSTALLED, reason="pygraphviz is required")
74-
@pytest.mark.parametrize("layout", _PARAMETRIZED_LAYOUTS)
65+
@pytest.mark.skipif(not _TEST_SHOULD_RUN, reason="pygraphviz is required")
66+
@pytest.mark.parametrize("layout", _GRAPH_LAYOUTS)
7567
@pytest.mark.parametrize("format_", _TEST_FORMATS)
7668
@pytest.mark.parametrize("rankdir", [_RankDirection.LR.value, _RankDirection.TB])
7769
def test_create_graph_via_task(tmp_path, runner, format_, layout, rankdir):

tox.ini

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,13 @@
22
envlist = pytest
33

44
[testenv]
5+
passenv = CI
56
usedevelop = true
6-
platform =
7-
linux: linux
8-
macos: darwin
9-
windows: win32
107

118
[testenv:pytest]
129
extras = test
1310
deps =
14-
linux, macos: pygraphviz
11+
pygraphviz;platform_system != "Windows"
1512

1613
commands =
1714
pytest {posargs} -vv

0 commit comments

Comments
 (0)