tests.py
author Radek Brich <radek.brich@devl.cz>
Sat, 29 Sep 2012 13:53:54 +0200
changeset 49 08e4dfe1b0cb
parent 48 b82c7c2fb5af
child 50 f71d3abbb18f
permissions -rwxr-xr-x
Add test for MyManager (enable only when MySQLdb is available). Configure tests using pgtoolkit.conf (same as used by other executables).
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48
b82c7c2fb5af PgManager: Fix logging, log queries before executing, possible exceptions are logged after. Add tests for RowDict. Add tests.py - runs all tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     1
#!/usr/bin/env python3
b82c7c2fb5af PgManager: Fix logging, log queries before executing, possible exceptions are logged after. Add tests for RowDict. Add tests.py - runs all tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     2
b82c7c2fb5af PgManager: Fix logging, log queries before executing, possible exceptions are logged after. Add tests for RowDict. Add tests.py - runs all tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     3
import unittest
b82c7c2fb5af PgManager: Fix logging, log queries before executing, possible exceptions are logged after. Add tests for RowDict. Add tests.py - runs all tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     4
b82c7c2fb5af PgManager: Fix logging, log queries before executing, possible exceptions are logged after. Add tests for RowDict. Add tests.py - runs all tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     5
from tests import test_rowdict
b82c7c2fb5af PgManager: Fix logging, log queries before executing, possible exceptions are logged after. Add tests for RowDict. Add tests.py - runs all tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     6
from tests import testpgmanager
b82c7c2fb5af PgManager: Fix logging, log queries before executing, possible exceptions are logged after. Add tests for RowDict. Add tests.py - runs all tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     7
49
08e4dfe1b0cb Add test for MyManager (enable only when MySQLdb is available). Configure tests using pgtoolkit.conf (same as used by other executables).
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
     8
enable_mysql = True
08e4dfe1b0cb Add test for MyManager (enable only when MySQLdb is available). Configure tests using pgtoolkit.conf (same as used by other executables).
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
     9
try:
08e4dfe1b0cb Add test for MyManager (enable only when MySQLdb is available). Configure tests using pgtoolkit.conf (same as used by other executables).
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    10
    from tests import test_mymanager
08e4dfe1b0cb Add test for MyManager (enable only when MySQLdb is available). Configure tests using pgtoolkit.conf (same as used by other executables).
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    11
except ImportError:
08e4dfe1b0cb Add test for MyManager (enable only when MySQLdb is available). Configure tests using pgtoolkit.conf (same as used by other executables).
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    12
    enable_mysql = False
08e4dfe1b0cb Add test for MyManager (enable only when MySQLdb is available). Configure tests using pgtoolkit.conf (same as used by other executables).
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    13
48
b82c7c2fb5af PgManager: Fix logging, log queries before executing, possible exceptions are logged after. Add tests for RowDict. Add tests.py - runs all tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    14
loader = unittest.TestLoader()
b82c7c2fb5af PgManager: Fix logging, log queries before executing, possible exceptions are logged after. Add tests for RowDict. Add tests.py - runs all tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    15
b82c7c2fb5af PgManager: Fix logging, log queries before executing, possible exceptions are logged after. Add tests for RowDict. Add tests.py - runs all tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    16
suite = unittest.TestSuite()
b82c7c2fb5af PgManager: Fix logging, log queries before executing, possible exceptions are logged after. Add tests for RowDict. Add tests.py - runs all tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    17
suite.addTests(loader.loadTestsFromModule(test_rowdict))
b82c7c2fb5af PgManager: Fix logging, log queries before executing, possible exceptions are logged after. Add tests for RowDict. Add tests.py - runs all tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    18
suite.addTests(loader.loadTestsFromModule(testpgmanager))
b82c7c2fb5af PgManager: Fix logging, log queries before executing, possible exceptions are logged after. Add tests for RowDict. Add tests.py - runs all tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    19
49
08e4dfe1b0cb Add test for MyManager (enable only when MySQLdb is available). Configure tests using pgtoolkit.conf (same as used by other executables).
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    20
if enable_mysql:
08e4dfe1b0cb Add test for MyManager (enable only when MySQLdb is available). Configure tests using pgtoolkit.conf (same as used by other executables).
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    21
    suite.addTests(loader.loadTestsFromModule(test_mymanager))
08e4dfe1b0cb Add test for MyManager (enable only when MySQLdb is available). Configure tests using pgtoolkit.conf (same as used by other executables).
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    22
48
b82c7c2fb5af PgManager: Fix logging, log queries before executing, possible exceptions are logged after. Add tests for RowDict. Add tests.py - runs all tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    23
runner = unittest.TextTestRunner(verbosity=2)
b82c7c2fb5af PgManager: Fix logging, log queries before executing, possible exceptions are logged after. Add tests for RowDict. Add tests.py - runs all tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    24
result = runner.run(suite)
b82c7c2fb5af PgManager: Fix logging, log queries before executing, possible exceptions are logged after. Add tests for RowDict. Add tests.py - runs all tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    25