Skip to content

Commit cad38f4

Browse files
committed
Use new fixture and add optional dependency ruff
1 parent 7c95548 commit cad38f4

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

test/unit/util/dependencies/audit_test.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ def test_reference_links(sample_vulnerability, reference: str, expected: list[st
9696
),
9797
)
9898
def test_vulnerability_id(self, sample_vulnerability, aliases: list[str], expected):
99-
10099
result = Vulnerability(
101100
package=sample_vulnerability.vulnerability.package,
102101
id="DUMMY_IDENTIFIER",
@@ -126,6 +125,11 @@ def test_subsection_for_changelog_summary(self, sample_vulnerability):
126125
)
127126

128127

128+
@pytest.fixture(scope="module")
129+
def new_pyproject_toml(create_new_poetry_project, project_path):
130+
return (project_path / "pyproject.toml").read_text()
131+
132+
129133
class TestExportDependenciesToFile:
130134
PACKAGES = [
131135
"astroid",
@@ -153,7 +157,12 @@ def extract_package_names(content) -> list[str]:
153157
)
154158

155159
@pytest.mark.parametrize(
156-
"pyproject_content", ["poetry_2_1_pyproject_text", "poetry_2_3_pyproject_text"]
160+
"pyproject_content",
161+
[
162+
"poetry_2_1_pyproject_text",
163+
"poetry_2_3_pyproject_text",
164+
"new_pyproject_toml",
165+
],
157166
)
158167
def test_poetry_export_versions(self, tmp_path, pyproject_content, request):
159168
content_str = request.getfixturevalue(pyproject_content)

test/unit/util/dependencies/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ def create_new_poetry_project(
107107
[poetry_path, "add", f"pylint=={sample_versions.pylint}"],
108108
[poetry_path, "add", "--group", "dev", f"isort=={sample_versions.isort}"],
109109
[poetry_path, "add", "--group", "analysis", f"black=={sample_versions.black}"],
110+
[poetry_path, "add", f"ruff@{sample_versions.ruff}", "--optional", "ruff"],
110111
]
111112
for cmd in commands:
112113
subprocess.run(cmd, cwd=project_path, env={}, check=True)

0 commit comments

Comments
 (0)