diff options
author | Christian Tismer <tismer@stackless.com> | 2017-11-30 06:14:24 +0100 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2017-11-30 10:05:49 +0000 |
commit | 7e734adb5d4e02eb1a50052473ac236c14e34862 (patch) | |
tree | 3662b62b8f327eeebee2fa25bf906ecd6ad4eadc /sources/pyside2/tests/registry/init_platform.py | |
parent | cd76d677faa1e988b68627919d479752a835efdf (diff) |
Fix signature registry on Python2 with .pyc files
There was a problem on Python2 when ci was activated.
Because there are .pyc files in the same folder,
a leftover .pyc file would be imported and lead to weird results.
This problem is not recognized now, but would have effects
when we turn on the multiple testing. The intended behavior
is that a tests generates an error and a listing once and
succeeds for the repeated test runs. This worked in Python3.
Now this works the same with Python2.
Task-number: PYSIDE-510
Change-Id: Id892715faa8eee1322b28c7e109f3b0b7329f12c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside2/tests/registry/init_platform.py')
-rw-r--r-- | sources/pyside2/tests/registry/init_platform.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sources/pyside2/tests/registry/init_platform.py b/sources/pyside2/tests/registry/init_platform.py index 77fff4476..ea8eb2af2 100644 --- a/sources/pyside2/tests/registry/init_platform.py +++ b/sources/pyside2/tests/registry/init_platform.py @@ -61,6 +61,7 @@ is_ci = os.environ.get("QTEST_ENVIRONMENT", "") == "ci" platform = 'linux' if sys.platform.startswith('linux') else sys.platform outname = "exists_{}_{}{}.py".format(platform, version_id, "_ci" if is_ci else "") +outpath = os.path.join(os.path.dirname(__file__), outname) outfile = None def xprint(*args, **kw): @@ -142,9 +143,8 @@ def enum_module(mod_name): return ret def generate_all(): - fname = os.path.join(os.path.dirname(__file__), outname) global outfile - with open(fname, "w") as outfile: + with open(outpath, "w") as outfile: with open(__file__) as f: lines = f.readlines() license_line = next((lno for lno, line in enumerate(lines) @@ -156,7 +156,6 @@ def generate_all(): for mod_name in all_modules: enum_module(mod_name) xprint("# eof") - return fname def enum_all(): global outfile |