Mercurial > p > roundup > code
comparison test/test_anydbm.py @ 5033:63c79c0992ae
Update tests to work with py.test
py.test searches for any class that looks like a TestCase in the test
directory and tries to run them as tests. Some of the classes that
inherit TestCase are not meant to be run and are only intended to be
"helper classes". Only the tests of the classes that inherit the "helper
classes" should be run. If we convert these "helper classes" to be
"mixins" py.test should not pick them up.
| author | John Kristensen <john@jerrykan.com> |
|---|---|
| date | Thu, 20 Aug 2015 14:44:49 +1000 |
| parents | f6e76a03b502 |
| children | 364c54991861 |
comparison
equal
deleted
inserted
replaced
| 5032:fc0f7655411b | 5033:63c79c0992ae |
|---|---|
| 25 module = get_backend('anydbm') | 25 module = get_backend('anydbm') |
| 26 | 26 |
| 27 def nuke_database(self): | 27 def nuke_database(self): |
| 28 shutil.rmtree(config.DATABASE) | 28 shutil.rmtree(config.DATABASE) |
| 29 | 29 |
| 30 class anydbmDBTest(anydbmOpener, DBTest): | 30 |
| 31 class anydbmDBTest(anydbmOpener, DBTest, unittest.TestCase): | |
| 31 pass | 32 pass |
| 32 | 33 |
| 33 class anydbmROTest(anydbmOpener, ROTest): | 34 |
| 35 class anydbmROTest(anydbmOpener, ROTest, unittest.TestCase): | |
| 34 pass | 36 pass |
| 35 | 37 |
| 36 class anydbmSchemaTest(anydbmOpener, SchemaTest): | 38 |
| 39 class anydbmSchemaTest(anydbmOpener, SchemaTest, unittest.TestCase): | |
| 37 pass | 40 pass |
| 38 | 41 |
| 39 class anydbmClassicInitTest(ClassicInitTest): | 42 |
| 43 class anydbmClassicInitTest(ClassicInitTest, unittest.TestCase): | |
| 40 backend = 'anydbm' | 44 backend = 'anydbm' |
| 41 | 45 |
| 42 class anydbmHTMLItemTest(HTMLItemTest): | 46 |
| 47 class anydbmHTMLItemTest(HTMLItemTest, unittest.TestCase): | |
| 43 backend = 'anydbm' | 48 backend = 'anydbm' |
| 44 | 49 |
| 50 | |
| 45 from session_common import DBMTest | 51 from session_common import DBMTest |
| 46 class anydbmSessionTest(anydbmOpener, DBMTest): | 52 class anydbmSessionTest(anydbmOpener, DBMTest, unittest.TestCase): |
| 47 pass | 53 pass |
| 48 | 54 |
| 49 def test_suite(): | 55 def test_suite(): |
| 50 suite = unittest.TestSuite() | 56 suite = unittest.TestSuite() |
| 51 print 'Including anydbm tests' | 57 print 'Including anydbm tests' |
