66from typing import Iterator
77
88import pytest
9- from pytest import FixtureRequest
9+
10+
11+ @pytest .fixture (scope = "session" , autouse = True )
12+ def _use_poetry_env_var_config () -> None :
13+ # Triggers https://github.com/renan-r-santos/poetry-conda/issues/7
14+ os .environ ["POETRY_VIRTUALENVS_PROMPT" ] = "{project_name}-py{python_version}"
1015
1116
1217@pytest .fixture (
1520 {"python" : "3.8" , "poetry" : "1.3.0" },
1621 {"python" : "3.9" , "poetry" : "1.3.0" },
1722 {"python" : "3.10" , "poetry" : "1.3.0" },
18- {"python" : "3.11" , "poetry" : "1.3.0" },
19- {"python" : "3.11" , "poetry" : "1.4.0" },
2023 {"python" : "3.11" , "poetry" : "1.5.1" },
21- {"python" : "3.12" , "poetry" : "1.6.1" },
22- {"python" : "3.12" , "poetry" : "1.7.1" },
23- {"python" : "3.12" , "poetry" : "1.8.2" },
24+ {"python" : "3.12" , "poetry" : "1.8.3" },
2425 ],
2526 ids = lambda param : f"python-{ param ['python' ]} -poetry-{ param ['poetry' ]} " ,
2627)
27- def conda_environment (request : FixtureRequest ) -> Iterator [str ]:
28+ def conda_environment (request : pytest . FixtureRequest ) -> Iterator [str ]:
2829 python_version = request .param .get ("python" )
2930 poetry_version = request .param .get ("poetry" )
3031 random_string = "" .join (random .choices (ascii_letters + digits , k = 8 ))
@@ -54,8 +55,8 @@ def conda_environment(request: FixtureRequest) -> Iterator[str]:
5455 subprocess .run (["conda" , "remove" , "--prefix" , environment_path , "--all" , "--quiet" , "--yes" ], check = True )
5556
5657
57- @pytest .fixture
58- def remove_poetry_conda_plugin (conda_environment : str ) -> Iterator [None ]:
58+ @pytest .fixture ()
59+ def _remove_poetry_conda_plugin (conda_environment : str ) -> Iterator [None ]:
5960 subprocess .run (
6061 ["conda" , "run" , "--prefix" , conda_environment , "pip" , "uninstall" , "poetry-conda" , "--yes" ], check = True
6162 )
@@ -66,7 +67,7 @@ def remove_poetry_conda_plugin(conda_environment: str) -> Iterator[None]:
6667 subprocess .run (["conda" , "run" , "--prefix" , conda_environment , "pip" , "install" , "--no-deps" , root_dir ], check = True )
6768
6869
69- @pytest .fixture
70+ @pytest .fixture ()
7071def test_project_dir () -> Iterator [Path ]:
7172 test_project_dir = Path (__file__ ).parent / "test_project"
7273 current_cwd = Path .cwd ()
0 commit comments