author | Radek Brich <brich.radek@ifortuna.cz> |
Wed, 07 May 2014 18:33:50 +0200 | |
changeset 102 | fda45bdfd68d |
parent 83 | 515fadd3d286 |
permissions | -rwxr-xr-x |
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 |
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
|
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 |
75
39f777341db4
MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
11 |
except ImportError as e: |
39f777341db4
MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
12 |
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
|
13 |
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
|
14 |
|
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
|
15 |
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
|
16 |
|
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 = 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
|
18 |
suite.addTests(loader.loadTestsFromModule(test_rowdict)) |
50
f71d3abbb18f
Add test_prettysize to tests.py.
Radek Brich <radek.brich@devl.cz>
parents:
49
diff
changeset
|
19 |
suite.addTests(loader.loadTestsFromModule(test_pgmanager)) |
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
|
20 |
|
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
|
21 |
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
|
22 |
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
|
23 |
|
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
|
24 |
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
|
25 |
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
|
26 |