Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: remove unneeded install of graphviz on ubuntu #515

Merged
merged 9 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
allow-prereleases: true
- run: pip install tox

- if: matrix.os == 'ubunut-latest'
- if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install graphviz graphviz-dev
Expand Down
4 changes: 4 additions & 0 deletions docs/source/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ chronological order. Releases follow [semantic versioning](https://semver.org/)
releases are available on [PyPI](https://pypi.org/project/pytask) and
[Anaconda.org](https://anaconda.org/conda-forge/pytask).

## 0.4.5 - 2023-12-xx

- {pull}`515` enables tests with graphviz in CI. Thanks to {user}`NickCrews`.

## 0.4.4 - 2023-12-04

- {pull}`509` improves the documentation.
Expand Down
9 changes: 8 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,14 @@ docs = [
"sphinx-toolbox",
"sphinxext-opengraph",
]
test = ["pytest", "pytest-cov", "pytest-xdist", "syrupy", "deepdiff", "pexpect"]
test = [
"deepdiff",
"pexpect",
"pytest",
"pytest-cov",
"pytest-xdist",
"syrupy",
]

[project.urls]
Changelog = "https://pytask-dev.readthedocs.io/en/stable/changes.html"
Expand Down
28 changes: 10 additions & 18 deletions tests/test_dag_command.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import shutil
import os
import sys
import textwrap

Expand All @@ -16,26 +16,18 @@
else:
_IS_PYGRAPHVIZ_INSTALLED = True

# Test should run always on remote except on Windows and locally only with the package
# installed.
_TEST_SHOULD_RUN = _IS_PYGRAPHVIZ_INSTALLED or (
os.environ.get("CI") and sys.platform != "win32"
)
_GRAPH_LAYOUTS = ["neato", "dot", "fdp", "sfdp", "twopi", "circo"]


_PARAMETRIZED_LAYOUTS = [
pytest.param(
layout,
marks=pytest.mark.skip(reason=f"{layout} not available")
if shutil.which(layout) is None
else [],
)
for layout in _GRAPH_LAYOUTS
]


_TEST_FORMATS = ["dot", "pdf", "png", "jpeg", "svg"]


@pytest.mark.end_to_end()
@pytest.mark.skipif(not _IS_PYGRAPHVIZ_INSTALLED, reason="pygraphviz is required")
@pytest.mark.parametrize("layout", _PARAMETRIZED_LAYOUTS)
@pytest.mark.skipif(not _TEST_SHOULD_RUN, reason="pygraphviz is required")
@pytest.mark.parametrize("layout", _GRAPH_LAYOUTS)
@pytest.mark.parametrize("format_", _TEST_FORMATS)
@pytest.mark.parametrize("rankdir", ["LR"])
def test_create_graph_via_cli(tmp_path, runner, format_, layout, rankdir):
Expand Down Expand Up @@ -70,8 +62,8 @@ def task_example(): pass


@pytest.mark.end_to_end()
@pytest.mark.skipif(not _IS_PYGRAPHVIZ_INSTALLED, reason="pygraphviz is required")
@pytest.mark.parametrize("layout", _PARAMETRIZED_LAYOUTS)
@pytest.mark.skipif(not _TEST_SHOULD_RUN, reason="pygraphviz is required")
@pytest.mark.parametrize("layout", _GRAPH_LAYOUTS)
@pytest.mark.parametrize("format_", _TEST_FORMATS)
@pytest.mark.parametrize("rankdir", [_RankDirection.LR.value, _RankDirection.TB])
def test_create_graph_via_task(tmp_path, runner, format_, layout, rankdir):
Expand Down
7 changes: 2 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@
envlist = pytest

[testenv]
passenv = CI
usedevelop = true
platform =
linux: linux
macos: darwin
windows: win32

[testenv:pytest]
extras = test
deps =
linux, macos: pygraphviz
pygraphviz;platform_system != "Windows"

commands =
pytest {posargs} -vv