tests.py
author Radek Brich <radek.brich@devl.cz>
Tue, 19 Mar 2013 16:45:37 +0100
changeset 78 64c62ac8f65d
parent 75 39f777341db4
child 83 515fadd3d286
permissions -rwxr-xr-x
Rename config module to configparser.
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
50
f71d3abbb18f Add test_prettysize to tests.py.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
     6
from tests import test_pgmanager
f71d3abbb18f Add test_prettysize to tests.py.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
     7
from tests import test_prettysize
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
     8
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
     9
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
    10
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
    11
    from tests import test_mymanager
75
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 50
diff changeset
    12
except ImportError as e:
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 50
diff changeset
    13
    print('Disabling MySQL tests due to import error:\n ', str(e))
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
    14
    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
    15
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
    16
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
    17
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 = 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
    19
suite.addTests(loader.loadTestsFromModule(test_rowdict))
50
f71d3abbb18f Add test_prettysize to tests.py.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    20
suite.addTests(loader.loadTestsFromModule(test_pgmanager))
f71d3abbb18f Add test_prettysize to tests.py.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    21
suite.addTests(loader.loadTestsFromModule(test_prettysize))
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
    22
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
    23
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
    24
    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
    25
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
    26
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
    27
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
    28