@@ -191,11 +191,15 @@ class ProjectToTest:
191
191
192
192
# Where can we clone the project from?
193
193
git_url : str = ""
194
+ local_git : str = ""
194
195
slug : str = ""
195
196
env_vars : Env_VarsType = {}
196
197
197
198
def __init__ (self ) -> None :
198
- url_must_exist (self .git_url )
199
+ if self .git_url :
200
+ url_must_exist (self .git_url )
201
+ if self .local_git :
202
+ file_must_exist (self .local_git )
199
203
if not self .slug :
200
204
if self .git_url :
201
205
self .slug = self .git_url .split ("/" )[- 1 ]
@@ -211,12 +215,13 @@ def make_dir(self) -> None:
211
215
212
216
def get_source (self , shell : ShellSession , retries : int = 5 ) -> None :
213
217
"""Get the source of the project."""
218
+ git_source = self .local_git or self .git_url
214
219
for retry in range (retries ):
215
220
try :
216
- shell .run_command (f"git clone { self . git_url } { self .dir } " )
221
+ shell .run_command (f"git clone { git_source } { self .dir } " )
217
222
return
218
223
except Exception as e :
219
- print (f"Retrying to clone { self . git_url } due to error:\n { e } " )
224
+ print (f"Retrying to clone { git_source } due to error:\n { e } " )
220
225
if retry == retries - 1 :
221
226
raise e
222
227
@@ -423,6 +428,38 @@ def __init__(self, more_pytest_args: str = ""):
423
428
self .slug = "mashbranch"
424
429
425
430
431
+ class ProjectPillow (ProjectToTest ):
432
+ git_url = "https://github.com/python-pillow/Pillow"
433
+ local_git = "/src/Pillow"
434
+
435
+ def __init__ (self , more_pytest_args : str = "" ):
436
+ super ().__init__ ()
437
+ self .more_pytest_args = more_pytest_args
438
+
439
+ def prep_environment (self , env : Env ) -> None :
440
+ env .shell .run_command (f"{ env .python } -m pip install '.[tests]'" )
441
+
442
+ def run_no_coverage (self , env : Env ) -> float :
443
+ env .shell .run_command (f"{ env .python } -m pytest { self .more_pytest_args } " )
444
+ return env .shell .last_duration
445
+
446
+ def run_with_coverage (self , env : Env , cov_ver : Coverage ) -> float :
447
+ env .shell .run_command (f"{ env .python } -m pip install { cov_ver .pip_args } " )
448
+ env .shell .run_command (
449
+ f"{ env .python } -m pytest --cov=PIL --cov=Tests { self .more_pytest_args } "
450
+ )
451
+ duration = env .shell .last_duration
452
+ report = env .shell .run_command (f"{ env .python } -m coverage report --precision=6" )
453
+ print ("Results:" , report .splitlines ()[- 1 ])
454
+ return duration
455
+
456
+
457
+ class ProjectPillowBranch (ProjectPillow ):
458
+ def __init__ (self , more_pytest_args : str = "" ):
459
+ super ().__init__ (more_pytest_args = "--cov-branch " + more_pytest_args )
460
+ self .slug = "Pilbranch"
461
+
462
+
426
463
class ProjectOperator (ProjectToTest ):
427
464
git_url = "https://github.com/nedbat/operator"
428
465
0 commit comments