mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-08 23:04:15 +00:00
linting and test launcher fix
This commit is contained in:
2
test-ng.sh
vendored
2
test-ng.sh
vendored
@@ -36,7 +36,7 @@ if [ -z ${GITHUB_WORKFLOW} ]; then
|
|||||||
else
|
else
|
||||||
## CI/CD
|
## CI/CD
|
||||||
export COVERAGE_FILE="${cur}/.coverage"
|
export COVERAGE_FILE="${cur}/.coverage"
|
||||||
tests-ng/tests-launcher.py 1
|
tests-ng/tests-launcher.py
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# clear workdir
|
# clear workdir
|
||||||
|
|||||||
@@ -29,19 +29,21 @@ def run_test(logfd, path):
|
|||||||
path = os.path.join(cur, name)
|
path = os.path.join(cur, name)
|
||||||
|
|
||||||
if logfd:
|
if logfd:
|
||||||
logfd.write(f'starting test {path}\n')
|
logfd.write(f'starting test \"{path}\"\n')
|
||||||
|
logfd.flush()
|
||||||
proc = subprocess.Popen(path, shell=False,
|
proc = subprocess.Popen(path, shell=False,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.STDOUT)
|
stderr=subprocess.STDOUT,
|
||||||
|
text=True)
|
||||||
out, _ = proc.communicate()
|
out, _ = proc.communicate()
|
||||||
out = out.decode()
|
|
||||||
ret = proc.returncode == 0
|
ret = proc.returncode == 0
|
||||||
if logfd:
|
|
||||||
logfd.write(f'done test {path}\n')
|
|
||||||
reason = 'returncode'
|
reason = 'returncode'
|
||||||
if 'Traceback' in out:
|
if 'Traceback' in out:
|
||||||
ret = False
|
ret = False
|
||||||
reason = 'traceback'
|
reason = 'traceback'
|
||||||
|
if logfd:
|
||||||
|
logfd.write(f'done test \"{path}\": ok:{ret}\n')
|
||||||
|
logfd.flush()
|
||||||
return ret, reason, path, out
|
return ret, reason, path, out
|
||||||
|
|
||||||
|
|
||||||
@@ -60,7 +62,7 @@ def get_tests():
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""entry point"""
|
"""entry point"""
|
||||||
max_jobs = 10
|
max_jobs = None # number of processor
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
max_jobs = int(sys.argv[1])
|
max_jobs = int(sys.argv[1])
|
||||||
|
|
||||||
@@ -69,7 +71,9 @@ def main():
|
|||||||
logfd = sys.stdout
|
logfd = sys.stdout
|
||||||
if not is_cicd():
|
if not is_cicd():
|
||||||
logfd = open(LOG_FILE, 'w', encoding='utf-8')
|
logfd = open(LOG_FILE, 'w', encoding='utf-8')
|
||||||
logfd.write(f'start with {max_jobs} jobs\n')
|
if max_jobs:
|
||||||
|
logfd.write(f'start with {max_jobs} parallel worker(s)\n')
|
||||||
|
logfd.write(f'running {len(tests)} test(s)\n')
|
||||||
logfd.flush()
|
logfd.flush()
|
||||||
|
|
||||||
print()
|
print()
|
||||||
@@ -94,14 +98,14 @@ def main():
|
|||||||
remainer.cancel()
|
remainer.cancel()
|
||||||
print()
|
print()
|
||||||
print(log)
|
print(log)
|
||||||
print(f'test {name} failed ({reason})')
|
print(f'test \"{name}\" failed: {reason}')
|
||||||
logfd.close()
|
logfd.close()
|
||||||
return False
|
return False
|
||||||
sys.stdout.write('\n')
|
sys.stdout.write('\n')
|
||||||
if spinner:
|
if spinner:
|
||||||
spinner.stop()
|
spinner.stop()
|
||||||
print()
|
print()
|
||||||
logfd.write(f'done with {max_jobs} jobs\n')
|
logfd.write(f'done - ran {len(tests)} test(s)\n')
|
||||||
logfd.close()
|
logfd.close()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user