Skip to content

Commit d5d29c1

Browse files
committed
Isolate poetry add and install to local virtual env in tmp_path
1 parent ccecc7f commit d5d29c1

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

test/integration/conftest.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import subprocess
2+
3+
import pytest
4+
5+
6+
@pytest.fixture(scope="session")
7+
def poetry_path() -> str:
8+
result = subprocess.run(["which", "poetry"], capture_output=True, text=True)
9+
poetry_path = result.stdout.strip()
10+
return poetry_path

test/integration/project-template/conftest.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ def git_path() -> str:
3737
return git_path
3838

3939

40-
@pytest.fixture(scope="session")
41-
def poetry_path() -> str:
42-
result = subprocess.run(["which", "poetry"], capture_output=True, text=True)
43-
poetry_path = result.stdout.strip()
44-
return poetry_path
4540

4641

4742
@pytest.fixture(scope="session")

test/integration/util/dependencies/audit_integration_test.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,19 @@
88

99

1010
@pytest.fixture
11-
def create_poetry_project(tmp_path, sample_vulnerability):
11+
def create_poetry_project(tmp_path, sample_vulnerability, poetry_path):
1212
project_name = "vulnerability"
13-
subprocess.run(["poetry", "new", project_name], cwd=tmp_path)
13+
subprocess.run([poetry_path, "new", project_name], cwd=tmp_path, env={})
1414

1515
poetry_root_dir = tmp_path / project_name
1616
subprocess.run(
1717
[
18-
"poetry",
18+
poetry_path,
1919
"add",
2020
f"{sample_vulnerability.package_name}=={sample_vulnerability.version}",
2121
],
2222
cwd=poetry_root_dir,
23+
env={},
2324
)
2425

2526
poetry_export = cleandoc(
@@ -33,8 +34,9 @@ def create_poetry_project(tmp_path, sample_vulnerability):
3334
f.write(poetry_export)
3435

3536
subprocess.run(
36-
["poetry", "install"],
37+
[poetry_path, "install"],
3738
cwd=poetry_root_dir,
39+
env={},
3840
)
3941

4042
return poetry_root_dir

0 commit comments

Comments
 (0)