1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00

Move tests so that standard library unittest discovery finds them

This commit is contained in:
Juhani Numminen 2021-02-07 13:32:15 +02:00
parent dbe57dda67
commit 6a55a0b262
15 changed files with 15 additions and 31 deletions

View file

@ -61,9 +61,8 @@ pretest:
python3 scripts/gen_individual_importing_tests.py
TEST_ENV_PATH = $(CURDIR)$(path_sep)$(CURDIR)/tests/lib
TEST_FILES = tests/style/*.t tests/unit-generated/*.py tests/individually-importing/*.py
TEST_FILES = tests/tap_unittests.py tests/style/*.t tests/individually-importing/*.py
test runtest: export PYTHONPATH := $(PYTHONPATH)$(path_sep)$(TEST_ENV_PATH)
test runtest: export PERL5LIB := $(PERL5LIB)$(path_sep)$(TEST_ENV_PATH)
test: pretest

View file

@ -156,7 +156,9 @@ sub myglob
my @tests =
sort { ( basename($a) cmp basename($b) ) || ( $a cmp $b ) }
( myglob("$abs_bindir/tests/*") );
( myglob("$abs_bindir/tests/{style,individually-importing}") );
push @tests, "$abs_bindir/tests/tap_unittests.py";
if ($IS_WIN)
{

View file

@ -40,27 +40,3 @@ 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.cardsetparser',
'pysol_tests.game_drag',
'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})

7
tests/tap_unittests.py Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env python3
import unittest
from pycotap import LogMode, TAPTestRunner
suite = unittest.TestLoader().discover('.')
TAPTestRunner(LogMode.LogToError).run(suite)

View file

@ -2,11 +2,11 @@
import unittest
from pysol_tests.common_mocks1 import MockApp, MockCanvas, MockTalon
import pysollib.stack
from pysollib.hint import FreeCellSolver_Hint, PySolHintLayoutImportError
from .common_mocks1 import MockApp, MockCanvas, MockTalon
class MockGame:
def __init__(self):

View file

@ -2,14 +2,14 @@
import unittest
from pysol_tests.common_mocks1 import MockApp, MockCanvas, MockItem, MockTalon
import pysollib.stack
from pysollib.acard import AbstractCard
from pysollib.games.spider import ScorpionTail_RowStack
from pysollib.games.spider import Scorpion_RowStack
from pysollib.games.spider import Spider_RowStack
from .common_mocks1 import MockApp, MockCanvas, MockItem, MockTalon
class MockGame:
def __init__(self):