|
1 | 1 | #!/usr/bin/env python |
2 | | - |
3 | | - |
4 | 2 | import platform |
5 | | -from os.path import abspath, dirname, join |
| 3 | +import shutil |
6 | 4 | import sys |
| 5 | +from os.path import abspath, dirname, isdir, join |
| 6 | +from pathlib import Path |
7 | 7 |
|
8 | | -from robot import run, rebot |
| 8 | +from robot import rebot, run |
9 | 9 | from robot.version import VERSION as rf_version |
10 | 10 | from robotstatuschecker import process_output |
11 | 11 |
|
12 | | - |
13 | | -library_variants = ['Hybrid', 'Dynamic', 'ExtendExisting'] |
| 12 | +library_variants = ["Hybrid", "Dynamic", "ExtendExisting"] |
14 | 13 | curdir = dirname(abspath(__file__)) |
15 | | -outdir = join(curdir, 'results') |
16 | | -tests = join(curdir, 'tests.robot') |
17 | | -tests_types = join(curdir, 'tests_types.robot') |
18 | | -sys.path.insert(0, join(curdir, '..', 'src')) |
| 14 | +outdir = join(curdir, "results") |
| 15 | +if isdir(outdir): |
| 16 | + shutil.rmtree(outdir, ignore_errors=True) |
| 17 | +tests = join(curdir, "tests.robot") |
| 18 | +tests_types = join(curdir, "tests_types.robot") |
| 19 | +plugin_api = join(curdir, "plugin_api") |
| 20 | +sys.path.insert(0, join(curdir, "..", "src")) |
19 | 21 | python_version = platform.python_version() |
20 | 22 | for variant in library_variants: |
21 | | - output = join(outdir, 'lib-{}-python-{}-robot-{}.xml'.format(variant, python_version, rf_version)) |
22 | | - rc = run(tests, name=variant, variable='LIBRARY:%sLibrary' % variant, |
23 | | - output=output, report=None, log=None, loglevel='debug') |
| 23 | + output = join(outdir, "lib-{}-python-{}-robot-{}.xml".format(variant, python_version, rf_version)) |
| 24 | + rc = run( |
| 25 | + tests, |
| 26 | + name=variant, |
| 27 | + variable="LIBRARY:%sLibrary" % variant, |
| 28 | + output=output, |
| 29 | + report=None, |
| 30 | + log=None, |
| 31 | + loglevel="debug", |
| 32 | + ) |
24 | 33 | if rc > 250: |
25 | 34 | sys.exit(rc) |
26 | 35 | process_output(output, verbose=False) |
27 | | -output = join(outdir, 'lib-DynamicTypesLibrary-python-{}-robot-{}.xml'.format(python_version, rf_version)) |
| 36 | +output = join(outdir, "lib-DynamicTypesLibrary-python-{}-robot-{}.xml".format(python_version, rf_version)) |
28 | 37 | exclude = "py310" if sys.version_info < (3, 10) else "" |
29 | | -rc = run(tests_types, name='Types', output=output, report=None, log=None, loglevel='debug', exclude=exclude) |
| 38 | +rc = run(tests_types, name="Types", output=output, report=None, log=None, loglevel="debug", exclude=exclude) |
| 39 | +if rc > 250: |
| 40 | + sys.exit(rc) |
| 41 | +process_output(output, verbose=False) |
| 42 | +output = join(outdir, "lib-PluginApi-python-{}-robot-{}.xml".format(python_version, rf_version)) |
| 43 | +rc = run(plugin_api, name="Plugin", output=output, report=None, log=None, loglevel="debug") |
30 | 44 | if rc > 250: |
31 | 45 | sys.exit(rc) |
32 | 46 | process_output(output, verbose=False) |
33 | | -print('\nCombining results.') |
34 | | -library_variants.append('DynamicTypesLibrary') |
35 | | -rc = rebot(*(join(outdir, 'lib-{}-python-{}-robot-{}.xml'.format(variant, python_version, rf_version)) for variant in library_variants), |
36 | | - **dict(name='Acceptance Tests', outputdir=outdir, log='log-python-{}-robot-{}.html'.format(python_version, rf_version), |
37 | | - report='report-python-{}-robot-{}.html'.format(python_version, rf_version))) |
| 47 | +print("\nCombining results.") |
| 48 | +library_variants.append("DynamicTypesLibrary") |
| 49 | +xml_files = [str(xml_file) for xml_file in Path(outdir).glob("*.xml")] |
| 50 | +for xxx in xml_files: |
| 51 | + print(xxx) |
| 52 | +rc = rebot( |
| 53 | + *xml_files, |
| 54 | + **dict( |
| 55 | + name="Acceptance Tests", |
| 56 | + outputdir=outdir, |
| 57 | + log="log-python-{}-robot-{}.html".format(python_version, rf_version), |
| 58 | + report="report-python-{}-robot-{}.html".format(python_version, rf_version), |
| 59 | + ), |
| 60 | +) |
38 | 61 | if rc == 0: |
39 | | - print('\nAll tests passed/failed as expected.') |
| 62 | + print("\nAll tests passed/failed as expected.") |
40 | 63 | else: |
41 | | - print('\n%d test%s failed.' % (rc, 's' if rc != 1 else '')) |
| 64 | + print("\n%d test%s failed." % (rc, "s" if rc != 1 else "")) |
42 | 65 | sys.exit(rc) |
0 commit comments