mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
56 lines
1.7 KiB
Python
56 lines
1.7 KiB
Python
#!/usr/bin/env python
|
|
# Written by Shlomi Fish, under the MIT Expat License.
|
|
|
|
import os
|
|
import os.path
|
|
import re
|
|
from sys import platform
|
|
|
|
IS_MAC = (platform == "darwin")
|
|
PY_VERS = ([] if re.search("\\bSKIP_PY2\\b",
|
|
os.getenv('TEST_TAGS', '')) else [2])+[3]
|
|
module_names = []
|
|
for d, _, files in os.walk("pysollib"):
|
|
for f in files:
|
|
if re.search("\\.py$", f):
|
|
module_names.append(
|
|
(d + "/" + re.sub("\\.py$", "", f)).replace("/", "."))
|
|
|
|
module_names.sort()
|
|
for module_name in module_names:
|
|
if "kivy" in module_name:
|
|
continue
|
|
is_gtk = ("gtk" in module_name)
|
|
for ver in PY_VERS:
|
|
if ((not is_gtk) or (ver == 2 and (not IS_MAC))):
|
|
def fmt(s):
|
|
return s % {'module_name': module_name, 'ver': ver}
|
|
open(os.path.join(".", "tests", "individually-importing", fmt("import_v%(ver)d_%(module_name)s.py")), 'w').write(fmt('''#!/usr/bin/env python%(ver)d
|
|
import sys
|
|
print('1..1')
|
|
sys.path.insert(0, ".")
|
|
import %(module_name)s
|
|
print('ok 1 - imported')
|
|
'''))
|
|
|
|
for ver in PY_VERS:
|
|
for mod in [
|
|
'pysol_tests.acard_unit',
|
|
'pysol_tests.hint',
|
|
'pysol_tests.import_file1',
|
|
'pysol_tests.latin1_conv_unit',
|
|
'pysol_tests.ms_deals1',
|
|
'pysol_tests.scorpion_canMove',
|
|
]:
|
|
open(os.path.join(".", "tests", "unit-generated",
|
|
'test__%s__v%d.py' % (mod, ver)
|
|
), 'w').write('''#!/usr/bin/env python%(ver)d
|
|
import unittest
|
|
|
|
from pycotap import TAPTestRunner
|
|
|
|
from %(mod)s import MyTests
|
|
|
|
suite = unittest.TestLoader().loadTestsFromTestCase(MyTests)
|
|
TAPTestRunner().run(suite)
|
|
''' % {'mod': mod, 'ver': ver})
|