Skip to content

Commit

Permalink
run ruff formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
alexreinking committed Jan 7, 2025
1 parent 625b33a commit 991ccad
Show file tree
Hide file tree
Showing 4 changed files with 599 additions and 429 deletions.
6 changes: 3 additions & 3 deletions master/buildbot.tac
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ configfile = 'master.cfg'
# Default umask for server
umask = None

logfile = LogFile.fromFullPath(os.path.join(basedir, "twistd.log"),
rotateLength=rotateLength,
maxRotatedFiles=maxRotatedFiles)
logfile = LogFile.fromFullPath(
os.path.join(basedir, "twistd.log"), rotateLength=rotateLength, maxRotatedFiles=maxRotatedFiles
)

# note: this line is matched against to check that this is a buildmaster
# directory; do not edit it.
Expand Down
49 changes: 33 additions & 16 deletions master/custom_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class SetPropertiesFromCMakeCache(CompositeStepMixin, BuildStep):
:([^=]*) # and will have a type.
=(.*)$ # The value extends through the end of the line.
''',
re.VERBOSE)
re.VERBOSE,
)

def __init__(self, *, props=None, normalize_bools=False, expand_lists=False, **kwargs):
super().__init__(**kwargs)
Expand Down Expand Up @@ -119,7 +120,7 @@ def run(self):
# Delete all but the newest self.keep files with the same key.
for group in groups.values():
group.sort(key=os.path.getmtime, reverse=True)
for file in group[self.keep:]:
for file in group[self.keep :]:
try:
file.unlink()
stdio.addStdout(f'Removed: {file.resolve()}\n')
Expand Down Expand Up @@ -154,8 +155,19 @@ def run(self):
class CTest(ShellMixin, CompositeStepMixin, BuildStep):
name = 'ctest'

def __init__(self, *, build_config=None, preset=None, jobs=None, tests=None, exclude_tests=None,
labels=None, exclude_labels=None, test_dir=None, **kwargs):
def __init__(
self,
*,
build_config=None,
preset=None,
jobs=None,
tests=None,
exclude_tests=None,
labels=None,
exclude_labels=None,
test_dir=None,
**kwargs,
):
kwargs['command'] = [
'ctest',
# Note, jobs may be a renderable, don't explicitly convert to str
Expand All @@ -168,8 +180,9 @@ def __init__(self, *, build_config=None, preset=None, jobs=None, tests=None, exc
# We always want output from performance tests
*(['--verbose'] if labels and 'performance' in labels else []),
'--output-on-failure',
'--test-action', 'Test',
'--no-compress-output'
'--test-action',
'Test',
'--no-compress-output',
]
assert (build_config is None) ^ (preset is None), "You must pass either build_config or preset, but not both"
if build_config:
Expand Down Expand Up @@ -201,23 +214,27 @@ def run(self):

for test in root.findall(".//Test[@Status='failed']"):
log = yield self.addLog(test.findtext('Name'))
self.write_xml(test,
("./Results/NamedMeasurement[@name='Environment']/Value", log.addHeader),
("./Results/NamedMeasurement[@name='Command Line']/Value", log.addHeader),
("./Results/Measurement/Value", log.addStdout),
("./Results/NamedMeasurement[@name='Fail Reason']/Value", log.addStderr))
self.write_xml(
test,
("./Results/NamedMeasurement[@name='Environment']/Value", log.addHeader),
("./Results/NamedMeasurement[@name='Command Line']/Value", log.addHeader),
("./Results/Measurement/Value", log.addStdout),
("./Results/NamedMeasurement[@name='Fail Reason']/Value", log.addStderr),
)
yield log.finish()

skipped = root.findall(".//Test[@Status='notrun']")
if skipped:
log = yield self.addLog('skipped')
for test in skipped:
log.addStdout(f'{test.findtext("Name")}\n')
self.write_xml(test,
("./Results/NamedMeasurement[@name='Environment']/Value", log.addHeader),
("./Results/NamedMeasurement[@name='Command Line']/Value", log.addHeader),
("./Results/Measurement/Value", log.addStdout),
indent=2)
self.write_xml(
test,
("./Results/NamedMeasurement[@name='Environment']/Value", log.addHeader),
("./Results/NamedMeasurement[@name='Command Line']/Value", log.addHeader),
("./Results/Measurement/Value", log.addStdout),
indent=2,
)
log.addStdout('\n')
yield log.finish()

Expand Down
Loading

0 comments on commit 991ccad

Please sign in to comment.