Skip to content

Commit 5562494

Browse files
committed
Integrate REST tests into db framework
1 parent d68a317 commit 5562494

File tree

5 files changed

+19
-10
lines changed

5 files changed

+19
-10
lines changed

test/test_rest.py renamed to test/rest_common.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
NEEDS_INSTANCE = 1
1616

1717

18-
class TestCase(unittest.TestCase):
18+
class TestCase():
1919

2020
backend = None
2121

@@ -510,15 +510,6 @@ def get_obj(path, id):
510510
'link': path + id
511511
}
512512

513-
514-
def test_suite():
515-
suite = unittest.TestSuite()
516-
for l in list_backends():
517-
dct = dict(backend=l)
518-
subcls = type(TestCase)('TestCase_%s' % l, (TestCase,), dct)
519-
suite.addTest(unittest.makeSuite(subcls))
520-
return suite
521-
522513
if __name__ == '__main__':
523514
runner = unittest.TextTestRunner()
524515
unittest.main(testRunner=runner)

test/test_anydbm.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
from .db_test_base import DBTest, ROTest, SchemaTest, ClassicInitTest, config
2222
from .db_test_base import HTMLItemTest, SpecialActionTest
23+
from .rest_common import TestCase as RestTestCase
2324

2425
class anydbmOpener:
2526
module = get_backend('anydbm')
@@ -56,4 +57,7 @@ class anydbmSpecialActionTestCase(anydbmOpener, SpecialActionTest,
5657
unittest.TestCase):
5758
backend = 'anydbm'
5859

60+
class anydbmRestTest (RestTestCase, unittest.TestCase):
61+
backend = 'anydbm'
62+
5963
# vim: set filetype=python ts=4 sw=4 et si

test/test_mysql.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from .db_test_base import DBTest, ROTest, config, SchemaTest, ClassicInitTest
2525
from .db_test_base import ConcurrentDBTest, HTMLItemTest, FilterCacheTest
2626
from .db_test_base import SpecialActionTest
27+
from .rest_common import TestCase as RestTestCase
2728

2829

2930
class mysqlOpener:
@@ -145,4 +146,8 @@ def tearDown(self):
145146
SpecialActionTest.tearDown(self)
146147
mysqlOpener.tearDown(self)
147148

149+
@skip_mysql
150+
class mysqlRestTest (RestTestCase, unittest.TestCase):
151+
backend = 'mysql'
152+
148153
# vim: set et sts=4 sw=4 :

test/test_postgresql.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from .db_test_base import DBTest, ROTest, config, SchemaTest, ClassicInitTest
2525
from .db_test_base import ConcurrentDBTest, HTMLItemTest, FilterCacheTest
2626
from .db_test_base import ClassicInitBase, setupTracker, SpecialActionTest
27+
from .rest_common import TestCase as RestTestCase
2728

2829
if not have_backend('postgresql'):
2930
# FIX: workaround for a bug in pytest.mark.skip():
@@ -225,4 +226,8 @@ def tearDown(self):
225226
SpecialActionTest.tearDown(self)
226227
postgresqlOpener.tearDown(self)
227228

229+
@skip_postgresql
230+
class postgresqlRestTest (RestTestCase, unittest.TestCase):
231+
backend = 'postgresql'
232+
228233
# vim: set et sts=4 sw=4 :

test/test_sqlite.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from .db_test_base import DBTest, ROTest, SchemaTest, ClassicInitTest, config
2222
from .db_test_base import ConcurrentDBTest, FilterCacheTest
2323
from .db_test_base import SpecialActionTest
24+
from .rest_common import TestCase as RestTestCase
2425

2526
class sqliteOpener:
2627
if have_backend('sqlite'):
@@ -61,3 +62,6 @@ class sqliteSpecialActionTestCase(sqliteOpener, SpecialActionTest,
6162
from .session_common import SessionTest
6263
class sqliteSessionTest(sqliteOpener, SessionTest, unittest.TestCase):
6364
pass
65+
66+
class sqliteRestTest (RestTestCase, unittest.TestCase):
67+
backend = 'sqlite'

0 commit comments

Comments
 (0)