1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-03 01:17:45 +03:00

test/run-unit-tests: make script compatible with python3.6

dataclasses were added in python3.7, but bionic has python3.6.
Yes, the new code is a travesty, but it does the job.

Fixes #19640.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-05-18 10:21:34 +02:00
parent c54cfef396
commit 6b908313ef

View File

@ -1,7 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import argparse import argparse
import dataclasses
import glob import glob
import os import os
import pathlib import pathlib
@ -17,12 +16,11 @@ try:
except ImportError: except ImportError:
GREEN = YELLOW = RED = RESET_ALL = BRIGHT = '' GREEN = YELLOW = RED = RESET_ALL = BRIGHT = ''
@dataclasses.dataclass class total:
class Total: total = None
total:int good = 0
good:int = 0 skip = 0
skip:int = 0 fail = 0
fail:int = 0
def argument_parser(): def argument_parser():
p = argparse.ArgumentParser() p = argparse.ArgumentParser()
@ -41,7 +39,7 @@ if opts.unsafe:
if not opts.artifact_directory and os.getenv('ARTIFACT_DIRECTORY'): if not opts.artifact_directory and os.getenv('ARTIFACT_DIRECTORY'):
opts.artifact_directory = os.getenv('ARTIFACT_DIRECTORY') opts.artifact_directory = os.getenv('ARTIFACT_DIRECTORY')
total = Total(total=len(tests)) total.total = len(tests)
for test in tests: for test in tests:
name = os.path.basename(test) name = os.path.basename(test)