33import json
44import re
55import subprocess
6- import sys
76from inspect import cleandoc
87from pathlib import Path
98
@@ -53,20 +52,15 @@ def create(self) -> PoetryProject:
5352 aux_subprocess (self .poetry , "new" , self .name , cwd = self .dir .parent )
5453 return self
5554
56- def use_python_version (self , version : sys . version_info ) -> PoetryProject :
55+ def set_minimum_python_version (self , version : str ) -> PoetryProject :
5756 content = self .toml .read_text ()
58- python_version = f"{ version .major } .{ version .minor } "
59- python_version = "3.10"
6057 changed = re .sub (
6158 r'^requires-python = ".*"$' ,
62- f'requires-python = ">={ python_version } "' ,
59+ f'requires-python = ">={ version } "' ,
6360 content ,
6461 flags = re .MULTILINE ,
6562 )
6663 self .toml .write_text (changed )
67- # aux_subprocess(
68- # self.poetry, "env", "use", f"python{python_version}", cwd=self.dir
69- # )
7064 return self
7165
7266 def add_package (self , spec : str ) -> PoetryProject :
@@ -84,11 +78,11 @@ def install(self) -> PoetryProject:
8478
8579
8680@pytest .fixture
87- def create_poetry_project (tmp_path , sample_vulnerability , poetry_path ):
81+ def create_poetry_project (tmp_path , sample_vulnerability , poetry_path , ptb_minimum_python_version ):
8882 project = (
8983 PoetryProject (poetry_path , tmp_path / "vulnerability" )
9084 .create ()
91- .use_python_version ( sys . version_info )
85+ .set_minimum_python_version ( ptb_minimum_python_version )
9286 .add_package (
9387 f"{ sample_vulnerability .package_name } ==" f"{ sample_vulnerability .version } "
9488 )
0 commit comments