Skip to content

Commit

Permalink
Update FileArbDevOpsPython flake8 command line argument from '-j 61' …
Browse files Browse the repository at this point in the history
…to '-j {multiprocessing.cpu_count()}'
  • Loading branch information
NeilJustice committed Nov 23, 2024
1 parent f7cbb16 commit 0d8cc43
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 3 additions & 1 deletion FileArbDevOpsPython/Python.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import glob
import multiprocessing
import os
import platform
import sys
Expand All @@ -7,7 +8,8 @@
PylintCommand = 'pylint --rcfile=.pylintrc --score=n '

def run_flake8() -> None:
flake8Command = 'flake8 -j 61 --config=.flake8 --show-source --benchmark'
cpuCount = multiprocessing.cpu_count()
flake8Command = f'flake8 -j {cpuCount} --config=.flake8 --show-source --benchmark'
Process.fail_fast_run(flake8Command)

def run_mypy() -> None:
Expand Down
2 changes: 1 addition & 1 deletion FileArbDevOpsPythonTests/FileArbDevOpsPythonTests.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ProjectGuid>5be2bd06-b3d6-4e12-9d37-cb82aa0ef9d3</ProjectGuid>
<ProjectHome>
</ProjectHome>
<StartupFile>RunAll.py</StartupFile>
<StartupFile>PythonTests.py</StartupFile>
<SearchPath>..\</SearchPath>
<WorkingDirectory>..</WorkingDirectory>
<OutputPath>.</OutputPath>
Expand Down
9 changes: 6 additions & 3 deletions FileArbDevOpsPythonTests/PythonTests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import glob
import multiprocessing
import os
import platform
import sys
Expand All @@ -22,11 +22,14 @@ class PythonTests(unittest.TestCase):

@staticmethod
@patch('FileArbDevOpsPython.Process.fail_fast_run', spec_set=True)
def test_run_flake8_RunsFlake8WithFlake8Config(_1):
@patch('multiprocessing.cpu_count', spec_set=True)
def test_run_flake8_RunsFlake8WithFlake8Config(_1, _2):
cpuCount = Random.integer()
multiprocessing.cpu_count.return_value = cpuCount
#
Python.run_flake8()
#
expectedFlake8Command = 'flake8 -j 61 --config=.flake8 --show-source --benchmark'
expectedFlake8Command = f'flake8 -j {cpuCount} --config=.flake8 --show-source --benchmark'
Process.fail_fast_run.assert_called_once_with(expectedFlake8Command)

@staticmethod
Expand Down

0 comments on commit 0d8cc43

Please sign in to comment.