aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
Diffstat (limited to 'sources')
-rw-r--r--sources/pyside2/tests/registry/existence_test.py14
-rw-r--r--sources/pyside2/tests/registry/init_platform.py5
2 files changed, 11 insertions, 8 deletions
diff --git a/sources/pyside2/tests/registry/existence_test.py b/sources/pyside2/tests/registry/existence_test.py
index acdd43570..7627eeab2 100644
--- a/sources/pyside2/tests/registry/existence_test.py
+++ b/sources/pyside2/tests/registry/existence_test.py
@@ -43,12 +43,16 @@ import os
import sys
import unittest
import warnings
-from init_platform import enum_all, generate_all, is_ci, outname
+from init_platform import enum_all, generate_all, is_ci, outname, outpath
from util import isolate_warnings, check_warnings
from PySide2 import *
from PySide2.QtCore import __version__
refmodule_name = outname[:-3] # no .py
+pyc = os.path.splitext(outpath)[0] + ".pyc"
+if os.path.exists(pyc) and not os.path.exists(outname):
+ # on Python2 the pyc file would be imported
+ os.unlink(pyc)
sys.path.insert(0, os.path.dirname(__file__))
try:
@@ -101,12 +105,12 @@ if not have_refmodule and is_ci and version[:2] in tested_versions:
It creates an output listing that can be used to check
the result back in.
"""
- fname = generate_all()
+ generate_all()
sys.stderr.flush()
- print("BEGIN", fname, file=sys.stderr)
- with open(fname) as f:
+ print("BEGIN", outpath, file=sys.stderr)
+ with open(outpath) as f:
print(f.read(), file=sys.stderr)
- print("END", fname, file=sys.stderr)
+ print("END", outpath, file=sys.stderr)
sys.stderr.flush()
raise RuntimeError("This is the initial call. You should check this file in.")
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