Skip to content

Commit 8dd2951

Browse files
authored
Merge pull request #46 from robust-python/develop
Testing Improvements
2 parents b2ba610 + 48f54a3 commit 8dd2951

File tree

4 files changed

+38
-19
lines changed

4 files changed

+38
-19
lines changed

.pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[pytest]
2-
addopts = --show-capture=all
2+
addopts = --show-capture=all --ignore="{{cookiecutter.project_name}}"

tests/integration_tests/test_robust_python_demo.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,13 @@ def test_demo_project_nox_pre_commit(robust_demo: Path) -> None:
4040
assert result.returncode == 0
4141

4242

43-
@pytest.mark.parametrize(argnames="robust_demo__add_rust_extension", argvalues=[True, False], indirect=True)
44-
@pytest.mark.parametrize(argnames="robust_demo__is_setup", argvalues=[False], indirect=True)
43+
@pytest.mark.parametrize(
44+
argnames="robust_demo__add_rust_extension",
45+
argvalues=[True, False],
46+
indirect=True,
47+
ids=["maturin", "python"]
48+
)
49+
@pytest.mark.parametrize(argnames="robust_demo__is_setup", argvalues=[False], indirect=True, ids=["no-setup"])
4550
def test_demo_project_nox_pre_commit_with_install(robust_demo: Path) -> None:
4651
command: list[str] = ["nox", "-s", "pre-commit", "--", "install"]
4752
pre_commit_hook_path: Path = robust_demo / ".git" / "hooks" / "pre-commit"
Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
from functools import partial
21
from typing import Any
32

43
import pytest
54

6-
from util import templates_matching
5+
from tests.util import templates_matching
76

87

98
@pytest.mark.parametrize(
@@ -12,18 +11,33 @@
1211
indirect=True,
1312
ids=["no-setup"]
1413
)
15-
@pytest.mark.parametrize(
16-
argnames="robust_demo__add_rust_extension",
17-
argvalues=[False, True],
18-
indirect=True,
19-
ids=["base", "maturin"]
20-
)
21-
@pytest.mark.parametrize(
22-
argnames="robust_file__path__relative",
23-
argvalues=templates_matching(".github/workflows/*.yml"),
24-
indirect=True,
25-
ids=lambda path: path.stem
26-
)
2714
class TestWorkflow:
28-
def test_workflow_basic_loading(self, robust_yaml: dict[str, Any]) -> None:
15+
@pytest.mark.parametrize(
16+
argnames="robust_demo__add_rust_extension",
17+
argvalues=[False],
18+
indirect=True,
19+
ids=["base"]
20+
)
21+
@pytest.mark.parametrize(
22+
argnames="robust_file__path__relative",
23+
argvalues=templates_matching(".github/workflows/*[!rust].yml"),
24+
indirect=True,
25+
ids=lambda path: path.stem
26+
)
27+
def test_workflow_basic_loading_with_python(self, robust_yaml: dict[str, Any]) -> None:
28+
assert robust_yaml
29+
30+
@pytest.mark.parametrize(
31+
argnames="robust_demo__add_rust_extension",
32+
argvalues=[True],
33+
indirect=True,
34+
ids=["maturin"]
35+
)
36+
@pytest.mark.parametrize(
37+
argnames="robust_file__path__relative",
38+
argvalues=templates_matching(".github/workflows/*.yml"),
39+
indirect=True,
40+
ids=lambda path: path.stem
41+
)
42+
def test_workflow_basic_loading_with_maturin(self, robust_yaml: dict[str, Any]) -> None:
2943
assert robust_yaml

tests/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Module containing utility functions used by tests."""
22
from pathlib import Path
33

4-
from constants import COOKIECUTTER_FOLDER
4+
from tests.constants import COOKIECUTTER_FOLDER
55

66

77
def templates_matching(pattern: str) -> list[Path]:

0 commit comments

Comments
 (0)