@@ -109,9 +109,7 @@ def run_command(self, cmd: str) -> str:
109109
110110 if proc .returncode != 0 :
111111 self .print (f"ERROR: command returned { proc .returncode } " )
112- raise Exception (
113- f"Command failed ({ proc .returncode } ): { cmd !r} , output was:\n { output } "
114- )
112+ raise Exception (f"Command failed ({ proc .returncode } ): { cmd !r} , output was:\n { output } " )
115113
116114 return output .strip ()
117115
@@ -318,9 +316,7 @@ def run_with_coverage(self, env: Env, cov_ver: Coverage) -> float:
318316 with self .tweak_coverage_settings (cov_ver .tweaks ):
319317 self .pre_check (env ) # NOTE: Not properly factored, and only used from here.
320318 duration = self .run_tox (env , env .pyver .toxenv , "--skip-pkg-install" )
321- self .post_check (
322- env
323- ) # NOTE: Not properly factored, and only used from here.
319+ self .post_check (env ) # NOTE: Not properly factored, and only used from here.
324320 return duration
325321
326322
@@ -333,9 +329,7 @@ def run_with_coverage(self, env: Env, cov_ver: Coverage) -> float:
333329 raise Exception ("This doesn't work because options changed to tweaks" )
334330 covenv = env .pyver .toxenv + "-cov" # type: ignore[unreachable]
335331 self .run_tox (env , covenv , "--notest" )
336- env .shell .run_command (
337- f".tox/{ covenv } /bin/python -m pip install { cov_ver .pip_args } "
338- )
332+ env .shell .run_command (f".tox/{ covenv } /bin/python -m pip install { cov_ver .pip_args } " )
339333 if cov_ver .tweaks :
340334 replace = ("# reference: https" , f"[run]\n { cov_ver .tweaks } \n #" )
341335 else :
@@ -499,9 +493,7 @@ def run_with_coverage(self, env: Env, cov_ver: Coverage) -> float:
499493 )
500494 with self .tweak_coverage_settings (cov_ver .tweaks ):
501495 self .pre_check (env ) # NOTE: Not properly factored, and only used here.
502- duration = self .run_tox (
503- env , env .pyver .toxenv , "--skip-pkg-install -- --cov"
504- )
496+ duration = self .run_tox (env , env .pyver .toxenv , "--skip-pkg-install -- --cov" )
505497 self .post_check (env ) # NOTE: Not properly factored, and only used here.
506498 return duration
507499
@@ -542,9 +534,7 @@ def run_no_coverage(self, env: Env) -> float:
542534
543535 def run_with_coverage (self , env : Env , cov_ver : Coverage ) -> float :
544536 env .shell .run_command (f"{ env .python } -m pip install { cov_ver .pip_args } " )
545- env .shell .run_command (
546- f"{ env .python } -m coverage run -m unittest tests.test_suite"
547- )
537+ env .shell .run_command (f"{ env .python } -m coverage run -m unittest tests.test_suite" )
548538 duration = env .shell .last_duration
549539 report = env .shell .run_command (f"{ env .python } -m coverage report --precision=6" )
550540 print ("Results:" , report .splitlines ()[- 1 ])
@@ -598,19 +588,21 @@ def run_with_coverage(self, env: Env, cov_ver: Coverage) -> float:
598588class ProjectMypy (ToxProject ):
599589 git_url = "https://github.com/python/mypy"
600590
601- SLOW_TESTS = " or " .join ([
602- "PythonCmdline" ,
603- "PEP561Suite" ,
604- "PythonEvaluation" ,
605- "testdaemon" ,
606- "StubgenCmdLine" ,
607- "StubgenPythonSuite" ,
608- "TestRun" ,
609- "TestRunMultiFile" ,
610- "TestExternal" ,
611- "TestCommandLine" ,
612- "ErrorStreamSuite" ,
613- ])
591+ SLOW_TESTS = " or " .join (
592+ [
593+ "PythonCmdline" ,
594+ "PEP561Suite" ,
595+ "PythonEvaluation" ,
596+ "testdaemon" ,
597+ "StubgenCmdLine" ,
598+ "StubgenPythonSuite" ,
599+ "TestRun" ,
600+ "TestRunMultiFile" ,
601+ "TestExternal" ,
602+ "TestCommandLine" ,
603+ "ErrorStreamSuite" ,
604+ ]
605+ )
614606
615607 FAST = f"-k 'not ({ SLOW_TESTS } )'"
616608
@@ -713,9 +705,7 @@ def tweak_toml_coverage_settings(toml_file: str, tweaks: TweaksType) -> Iterator
713705class AdHocProject (ProjectToTest ):
714706 """A standalone program to run locally."""
715707
716- def __init__ (
717- self , python_file : str , cur_dir : str | None = None , pip_args : str = ""
718- ):
708+ def __init__ (self , python_file : str , cur_dir : str | None = None , pip_args : str = "" ):
719709 super ().__init__ ()
720710 self .python_file = Path (python_file )
721711 if not self .python_file .exists ():
@@ -821,9 +811,7 @@ def __init__(self, slug: str = "nocov"):
821811class CoveragePR (Coverage ):
822812 """A version of coverage.py from a pull request."""
823813
824- def __init__ (
825- self , number : int , tweaks : TweaksType = None , env_vars : Env_VarsType = None
826- ):
814+ def __init__ (self , number : int , tweaks : TweaksType = None , env_vars : Env_VarsType = None ):
827815 url = f"https://github.com/nedbat/coveragepy.git@refs/pull/{ number } /merge"
828816 url_must_exist (url )
829817 super ().__init__ (
@@ -837,9 +825,7 @@ def __init__(
837825class CoverageCommit (Coverage ):
838826 """A version of coverage.py from a specific commit."""
839827
840- def __init__ (
841- self , sha : str , tweaks : TweaksType = None , env_vars : Env_VarsType = None
842- ):
828+ def __init__ (self , sha : str , tweaks : TweaksType = None , env_vars : Env_VarsType = None ):
843829 url = f"https://github.com/nedbat/coveragepy.git@{ sha } "
844830 url_must_exist (url )
845831 super ().__init__ (
@@ -915,18 +901,11 @@ def load_results(self) -> dict[ResultKey, list[float]]:
915901 if self .results_file .exists ():
916902 with self .results_file .open ("r" , encoding = "utf-8" ) as f :
917903 data : dict [str , list [float ]] = json .load (f )
918- return {
919- (k .split ()[0 ], k .split ()[1 ], k .split ()[2 ]): v for k , v in data .items ()
920- }
904+ return {(k .split ()[0 ], k .split ()[1 ], k .split ()[2 ]): v for k , v in data .items ()}
921905 return {}
922906
923907 def run (self , num_runs : int = 3 ) -> None :
924- total_runs = (
925- len (self .projects )
926- * len (self .py_versions )
927- * len (self .cov_versions )
928- * num_runs
929- )
908+ total_runs = len (self .projects ) * len (self .py_versions ) * len (self .cov_versions ) * num_runs
930909 total_run_nums = iter (itertools .count (start = 1 ))
931910
932911 all_runs = []
@@ -962,10 +941,7 @@ def run(self, num_runs: int = 3) -> None:
962941 for proj , pyver , cov_ver , env in all_runs :
963942 result_key = (proj .slug , pyver .slug , cov_ver .slug )
964943 total_run_num = next (total_run_nums )
965- if (
966- result_key in self .result_data
967- and len (self .result_data [result_key ]) >= num_runs
968- ):
944+ if result_key in self .result_data and len (self .result_data [result_key ]) >= num_runs :
969945 print (f"Skipping { result_key } as results already exist." )
970946 continue
971947
@@ -1100,9 +1076,7 @@ def run_experiment(
11001076 if any (rslug not in slugs for rslug in ratio_slugs ):
11011077 raise Exception (f"Ratio slug doesn't match a slug: { ratio_slugs } , { slugs } " )
11021078 if set (rows + [column ]) != set (DIMENSION_NAMES ):
1103- raise Exception (
1104- f"All of these must be in rows or column: { ', ' .join (DIMENSION_NAMES )} "
1105- )
1079+ raise Exception (f"All of these must be in rows or column: { ', ' .join (DIMENSION_NAMES )} " )
11061080
11071081 print (f"Removing and re-making { PERF_DIR } " )
11081082 remake (PERF_DIR )
0 commit comments