1
1
import glob
2
+ import multiprocessing
2
3
import os
3
4
import platform
4
5
import sys
9
10
10
11
testNames = [
11
12
'test_pylint_file_CallsPylintOnAllPythonFilesInCurrentFolderAndSubFolders' ,
13
+ 'test_run_flake8_RunsFlake8WithFlake8Config' ,
12
14
'test_run_mypy_RunsMypyDot' ,
13
15
'test_run_pylint_on_all_files_in_parallel_LinuxCallsMapParallelPylintFileWithAllPyFilePaths_WindowsCallsMapSequential' ,
14
- 'test_run_flake8_RunsFlake8WithFlake8Config' ,
15
16
'test_run_all_with_coverage_RunsCoverage_RunsReport_RunsHtml_RunsXml_ExitsWithReportExitCode'
16
17
]
17
18
@@ -30,6 +31,18 @@ def test_pylint_file_CallsPylintOnAllPythonFilesInCurrentFolderAndSubFolders(sel
30
31
Process .run_and_get_exit_code .assert_called_once_with (PythonTests .ExpectedPylintCommand + pythonFilePath )
31
32
self .assertEqual (pylintExitCode , pylintExitCode )
32
33
34
+ @staticmethod
35
+ @patch ('ZenUnitDevOpsPython.Process.fail_fast_run' , spec_set = True )
36
+ @patch ('multiprocessing.cpu_count' , spec_set = True )
37
+ def test_run_flake8_RunsFlake8WithFlake8Config (_1 , _2 ):
38
+ cpuCount = Random .integer ()
39
+ multiprocessing .cpu_count .return_value = cpuCount
40
+ #
41
+ Python .run_flake8 ()
42
+ #
43
+ expectedFlake8Command = f'flake8 -j { cpuCount } --config=.flake8 --show-source --benchmark'
44
+ Process .fail_fast_run .assert_called_once_with (expectedFlake8Command )
45
+
33
46
@staticmethod
34
47
@patch ('ZenUnitDevOpsPython.Process.fail_fast_run' , spec_set = True )
35
48
def test_run_mypy_RunsMypyDot (_1 ):
@@ -72,15 +85,6 @@ def testcase(platformSystem, expectedMapParallel, allPylintsSucceeded, expectSys
72
85
testcase ('Windows' , False , False , True )
73
86
testcase ('windows' , True , False , True )
74
87
75
- @staticmethod
76
- @patch ('ZenUnitDevOpsPython.Process.fail_fast_run' , spec_set = True )
77
- def test_run_flake8_RunsFlake8WithFlake8Config (_1 ):
78
- #
79
- Python .run_flake8 ()
80
- #
81
- expectedFlake8Command = 'flake8 -j 61 --config=.flake8 --show-source --benchmark'
82
- Process .fail_fast_run .assert_called_once_with (expectedFlake8Command )
83
-
84
88
def test_run_all_with_coverage_RunsCoverage_RunsReport_RunsHtml_RunsXml_ExitsWithReportExitCode (self ):
85
89
@patch ('os.getcwd' , spec_set = True )
86
90
@patch ('ZenUnitDevOpsPython.Process.fail_fast_run' , spec_set = True )
0 commit comments