Mercurial > p > roundup > code
annotate test/test_postgresql.py @ 7719:3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
Finally after 7 years this is closed.
roundup/backends/back_postgresql.py:
Support use of schema when specified in RDBMS_NAME. Stuart McGraws
code is finally merged 8-).
test/test_postgresql.py, test/conftest.py:
Run all postgresql tests in the schema db as well.
Also make sure that db_nuke raises an error when trying to delete
the schema test database. Conftest defines pg_schema mark that can
be used to exclude schema tests with pytest -m "not pg_schema".
roundup/configuration.py:
change doc on RDBMS_NAME to include db.schema form.
.travis.yml, .github/workflows/ci-test.yml:
create schema test db; add user for testing with schema; grant new
user create privs for schema.
doc/installation.txt:
Reference to roundup-admin init deleting schema added.
doc/mysql.txt doc/postgresql.txt:
New documentation on psql/mysql commands to set up a production db.
doc/upgrading.txt:
mention schema support, also document service setting for
selecting connection from pg_service.conf.
doc/reference.txt:
update config.ini documentation for RDBMS_NAME.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Wed, 27 Dec 2023 22:52:14 -0500 |
| parents | 521d98231e5c |
| children | 8147f6deac9f |
| rev | line source |
|---|---|
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1 # |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2 # Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/) |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3 # This module is free software, and you may redistribute it and/or modify |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
4 # under the same terms as Python, so long as this copyright message and |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
5 # disclaimer are retained in their original form. |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
6 # |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
7 # IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
8 # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
9 # OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
10 # POSSIBILITY OF SUCH DAMAGE. |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
11 # |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
12 # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
17 |
|
2075
b1704ba7be41
make mysql / postgresql work again. beginnings of otk/session store in rdbmses
Richard Jones <richard@users.sourceforge.net>
parents:
1920
diff
changeset
|
18 import unittest |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
19 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
20 import pytest |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
21 from roundup.hyperdb import DatabaseError |
|
5215
917e45d9ba08
test_postgress isn't properly skipping tests when database is not
John Rouillard <rouilj@ieee.org>
parents:
5118
diff
changeset
|
22 from roundup.backends import get_backend, have_backend |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
23 from roundup.backends.back_postgresql import db_command, db_schema_split |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
24 |
|
5388
d26921b851c3
Python 3 preparation: make relative imports explicit.
Joseph Myers <jsm@polyomino.org.uk>
parents:
5319
diff
changeset
|
25 from .db_test_base import DBTest, ROTest, config, SchemaTest, ClassicInitTest |
|
d26921b851c3
Python 3 preparation: make relative imports explicit.
Joseph Myers <jsm@polyomino.org.uk>
parents:
5319
diff
changeset
|
26 from .db_test_base import ConcurrentDBTest, HTMLItemTest, FilterCacheTest |
|
d26921b851c3
Python 3 preparation: make relative imports explicit.
Joseph Myers <jsm@polyomino.org.uk>
parents:
5319
diff
changeset
|
27 from .db_test_base import ClassicInitBase, setupTracker, SpecialActionTest |
|
5601
fcbeff272828
Integrate REST tests into db framework
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5388
diff
changeset
|
28 from .rest_common import TestCase as RestTestCase |
|
1906
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
29 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
30 if not have_backend('postgresql'): |
|
5109
43a1f7fe39f5
Improved work-around for pytest markers bug
John Kristensen <john@jerrykan.com>
parents:
5105
diff
changeset
|
31 # FIX: workaround for a bug in pytest.mark.skip(): |
|
43a1f7fe39f5
Improved work-around for pytest markers bug
John Kristensen <john@jerrykan.com>
parents:
5105
diff
changeset
|
32 # https://github.com/pytest-dev/pytest/issues/568 |
|
43a1f7fe39f5
Improved work-around for pytest markers bug
John Kristensen <john@jerrykan.com>
parents:
5105
diff
changeset
|
33 from .pytest_patcher import mark_class |
|
43a1f7fe39f5
Improved work-around for pytest markers bug
John Kristensen <john@jerrykan.com>
parents:
5105
diff
changeset
|
34 skip_postgresql = mark_class(pytest.mark.skip( |
|
43a1f7fe39f5
Improved work-around for pytest markers bug
John Kristensen <john@jerrykan.com>
parents:
5105
diff
changeset
|
35 reason='Skipping PostgreSQL tests: backend not available')) |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
36 else: |
|
5215
917e45d9ba08
test_postgress isn't properly skipping tests when database is not
John Rouillard <rouilj@ieee.org>
parents:
5118
diff
changeset
|
37 try: |
|
5751
5cb6e6b594b0
issue2551040: New release of psycopg2 drops support for psycopg1
John Rouillard <rouilj@ieee.org>
parents:
5601
diff
changeset
|
38 from roundup.backends.back_postgresql import psycopg2, db_command |
|
5215
917e45d9ba08
test_postgress isn't properly skipping tests when database is not
John Rouillard <rouilj@ieee.org>
parents:
5118
diff
changeset
|
39 db_command(config, 'select 1') |
|
917e45d9ba08
test_postgress isn't properly skipping tests when database is not
John Rouillard <rouilj@ieee.org>
parents:
5118
diff
changeset
|
40 skip_postgresql = lambda func, *args, **kwargs: func |
|
917e45d9ba08
test_postgress isn't properly skipping tests when database is not
John Rouillard <rouilj@ieee.org>
parents:
5118
diff
changeset
|
41 except( DatabaseError ) as msg: |
|
917e45d9ba08
test_postgress isn't properly skipping tests when database is not
John Rouillard <rouilj@ieee.org>
parents:
5118
diff
changeset
|
42 from .pytest_patcher import mark_class |
|
917e45d9ba08
test_postgress isn't properly skipping tests when database is not
John Rouillard <rouilj@ieee.org>
parents:
5118
diff
changeset
|
43 skip_postgresql = mark_class(pytest.mark.skip( |
|
917e45d9ba08
test_postgress isn't properly skipping tests when database is not
John Rouillard <rouilj@ieee.org>
parents:
5118
diff
changeset
|
44 reason='Skipping PostgreSQL tests: database not available')) |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
45 |
|
5215
917e45d9ba08
test_postgress isn't properly skipping tests when database is not
John Rouillard <rouilj@ieee.org>
parents:
5118
diff
changeset
|
46 @skip_postgresql |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
47 class postgresqlOpener: |
|
2856
adec352e2ce0
don't try to import all backends in backends.__init__ unless we *want* to
Richard Jones <richard@users.sourceforge.net>
parents:
2682
diff
changeset
|
48 if have_backend('postgresql'): |
|
adec352e2ce0
don't try to import all backends in backends.__init__ unless we *want* to
Richard Jones <richard@users.sourceforge.net>
parents:
2682
diff
changeset
|
49 module = get_backend('postgresql') |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
50 |
| 6622 | 51 def setup_class(cls): |
| 52 # nuke the db once for the class. Handles the case | |
| 53 # where an aborted test run (^C during setUp for example) | |
| 54 # leaves the database in an unusable, partly configured state. | |
| 55 try: | |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
56 cls.nuke_database() |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
57 except Exception as m: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
58 # ignore failure to nuke the database if it doesn't exist. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
59 # otherwise abort |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
60 if str(m.args[0]) == ( |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
61 'database "%s" does not exist' % config.RDBMS_NAME): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
62 pass |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
63 else: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
64 raise |
| 6622 | 65 |
|
1906
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
66 def setUp(self): |
|
2075
b1704ba7be41
make mysql / postgresql work again. beginnings of otk/session store in rdbmses
Richard Jones <richard@users.sourceforge.net>
parents:
1920
diff
changeset
|
67 pass |
|
1906
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
68 |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
69 def tearDown(self): |
|
1920
f9316d2cd5ba
Fixed retirement of items in rdbms imports [SF#841355]
Richard Jones <richard@users.sourceforge.net>
parents:
1906
diff
changeset
|
70 self.nuke_database() |
|
f9316d2cd5ba
Fixed retirement of items in rdbms imports [SF#841355]
Richard Jones <richard@users.sourceforge.net>
parents:
1906
diff
changeset
|
71 |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
72 @classmethod |
|
1920
f9316d2cd5ba
Fixed retirement of items in rdbms imports [SF#841355]
Richard Jones <richard@users.sourceforge.net>
parents:
1906
diff
changeset
|
73 def nuke_database(self): |
|
2075
b1704ba7be41
make mysql / postgresql work again. beginnings of otk/session store in rdbmses
Richard Jones <richard@users.sourceforge.net>
parents:
1920
diff
changeset
|
74 # clear out the database - easiest way is to nuke and re-create it |
|
2856
adec352e2ce0
don't try to import all backends in backends.__init__ unless we *want* to
Richard Jones <richard@users.sourceforge.net>
parents:
2682
diff
changeset
|
75 self.module.db_nuke(config) |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
76 |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
77 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
78 class postgresqlSchemaOpener: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
79 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
80 RDBMS_NAME="rounduptest_schema.rounduptest" |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
81 RDBMS_USER="rounduptest_schema" |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
82 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
83 if have_backend('postgresql'): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
84 module = get_backend('postgresql') |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
85 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
86 def setup_class(cls): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
87 # nuke the schema for the class. Handles the case |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
88 # where an aborted test run (^C during setUp for example) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
89 # leaves the database in an unusable, partly configured state. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
90 config.RDBMS_NAME=cls.RDBMS_NAME |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
91 config.RDBMS_USER=cls.RDBMS_USER |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
92 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
93 database, schema = db_schema_split(config.RDBMS_NAME) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
94 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
95 try: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
96 cls.nuke_database() |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
97 except Exception as m: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
98 # ignore failure to nuke the database if it doesn't exist. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
99 # otherwise abort |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
100 if str(m.args[0]) == ( |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
101 'schema "%s" does not exist' % schema): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
102 pass |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
103 else: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
104 raise |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
105 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
106 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
107 # make sure to override the rdbms settings. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
108 # before every test. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
109 config.RDBMS_NAME=self.RDBMS_NAME |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
110 config.RDBMS_USER=self.RDBMS_USER |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
111 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
112 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
113 self.nuke_database() |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
114 config.RDBMS_NAME="rounduptest" |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
115 config.RDBMS_USER="rounduptest" |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
116 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
117 @classmethod |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
118 def nuke_database(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
119 # clear out the database - easiest way is to nuke and re-create it |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
120 self.module.db_nuke(config) |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
121 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
122 @skip_postgresql |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
123 class postgresqlPrecreatedSchemaDbOpener: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
124 """Open the db where the user has only schema create rights. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
125 The test tries to nuke the db and should result in an exception. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
126 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
127 RDBMS_NAME should not have the .schema on it as we want to |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
128 operate on the db itself with db_nuke. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
129 """ |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
130 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
131 RDBMS_NAME="rounduptest_schema" |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
132 RDBMS_USER="rounduptest_schema" |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
133 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
134 if have_backend('postgresql'): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
135 module = get_backend('postgresql') |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
136 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
137 def setup_class(cls): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
138 # nuke the schema for the class. Handles the case |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
139 # where an aborted test run (^C during setUp for example) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
140 # leaves the database in an unusable, partly configured state. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
141 config.RDBMS_NAME=cls.RDBMS_NAME |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
142 config.RDBMS_USER=cls.RDBMS_USER |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
143 |
|
1906
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
144 def setUp(self): |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
145 # make sure to override the rdbms settings. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
146 # before every test. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
147 config.RDBMS_NAME=self.RDBMS_NAME |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
148 config.RDBMS_USER=self.RDBMS_USER |
|
1906
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
149 |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
150 def tearDown(self): |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
151 config.RDBMS_NAME="rounduptest" |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
152 config.RDBMS_USER="rounduptest" |
|
1906
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
153 |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
154 @classmethod |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
155 def nuke_database(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
156 # clear out the database - easiest way is to nuke and re-create it |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
157 self.module.db_nuke(config) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
158 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
159 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
160 class postgresqlAdditionalDBTest(): |
|
6599
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
161 def testUpgrade_6_to_7(self): |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
162 |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
163 # load the database |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
164 self.db.issue.create(title="flebble frooz") |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
165 self.db.commit() |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
166 |
|
6806
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
167 if self.db.database_schema['version'] > 7: |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
168 # make testUpgrades run the downgrade code only. |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
169 if hasattr(self, "downgrade_only"): |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
170 # we are being called by an earlier test |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
171 self.testUpgrade_7_to_8() |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
172 self.assertEqual(self.db.database_schema['version'], 7) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
173 else: |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
174 # we are being called directly |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
175 self.downgrade_only = True |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
176 self.testUpgrade_7_to_8() |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
177 self.assertEqual(self.db.database_schema['version'], 7) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
178 del(self.downgrade_only) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
179 elif self.db.database_schema['version'] != 7: |
|
6599
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
180 self.skipTest("This test only runs for database version 7") |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
181 |
|
6604
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
182 # remove __fts table/index; shrink length of __words._words |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
183 # trying to insert a long word in __words._words should fail. |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
184 # trying to select from __fts should fail |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
185 # looking for the index should fail |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
186 # run post-init |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
187 # tests should succeed. |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
188 |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
189 self.db.sql("drop table __fts") # also drops __fts_idx |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
190 self.db.sql("alter table __words ALTER column _word type varchar(10)") |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
191 self.db.commit() |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
192 |
|
6599
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
193 self.db.database_schema['version'] = 6 |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
194 |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
195 long_string = "a" * (self.db.indexer.maxlength + 5) |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
196 with self.assertRaises(psycopg2.DataError) as ctx: |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
197 # DataError : value too long for type character varying(10) |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
198 self.db.sql("insert into __words VALUES('%s',1)" % long_string) |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
199 |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
200 self.assertIn("varying(10)", ctx.exception.args[0]) |
|
6604
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
201 self.db.rollback() # clear cursor error so db.sql can be used again |
|
6599
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
202 |
|
6604
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
203 with self.assertRaises(psycopg2.errors.UndefinedTable) as ctx: |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
204 self.db.sql("select * from _fts") |
|
6599
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
205 self.db.rollback() |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
206 |
|
6605
3f13ddd98e5c
Replace does_index_exist with db.sql_index_exists.
John Rouillard <rouilj@ieee.org>
parents:
6604
diff
changeset
|
207 self.assertFalse(self.db.sql_index_exists('__fts', '__fts_idx')) |
|
6604
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
208 |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
209 if hasattr(self, "downgrade_only"): |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
210 return |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
211 |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
212 # test upgrade path |
|
6599
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
213 self.db.post_init() |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
214 |
|
7206
521d98231e5c
Test self.db.db_version_updated in schema upgrade paths
John Rouillard <rouilj@ieee.org>
parents:
6915
diff
changeset
|
215 self.assertEqual(self.db.db_version_updated, True) |
|
521d98231e5c
Test self.db.db_version_updated in schema upgrade paths
John Rouillard <rouilj@ieee.org>
parents:
6915
diff
changeset
|
216 |
|
6599
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
217 # This insert with text of expected column size should succeed |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
218 self.db.sql("insert into __words VALUES('%s',1)" % long_string) |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
219 |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
220 # verify it fails at one more than the expected column size |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
221 too_long_string = "a" * (self.db.indexer.maxlength + 6) |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
222 with self.assertRaises(psycopg2.DataError) as ctx: |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
223 self.db.sql("insert into __words VALUES('%s',1)" % too_long_string) |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
224 |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
225 # clean db handle |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
226 self.db.rollback() |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
227 |
|
6605
3f13ddd98e5c
Replace does_index_exist with db.sql_index_exists.
John Rouillard <rouilj@ieee.org>
parents:
6604
diff
changeset
|
228 self.assertTrue(self.db.sql_index_exists('__fts', '__fts_idx')) |
|
6604
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
229 |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
230 self.db.sql("select * from __fts") |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
231 |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
232 self.assertEqual(self.db.database_schema['version'], |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
233 self.db.current_db_version) |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
234 |
|
6806
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
235 def testUpgrade_7_to_8(self): |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
236 """ change _time fields in BasicDatabases to double """ |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
237 # load the database |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
238 self.db.issue.create(title="flebble frooz") |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
239 self.db.commit() |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
240 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
241 if self.db.database_schema['version'] != 8: |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
242 self.skipTest("This test only runs for database version 8") |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
243 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
244 # change otk and session db's _time value to their original types |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
245 sql = "alter table sessions alter column session_time type REAL;" |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
246 self.db.sql(sql) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
247 sql = "alter table otks alter column otk_time type REAL;" |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
248 self.db.sql(sql) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
249 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
250 # verify they truncate long ints. |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
251 test_double = 1658718284.7616878 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
252 for tablename in ['otk', 'session']: |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
253 self.db.sql( |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
254 'insert into %(name)ss(%(name)s_key, %(name)s_time, %(name)s_value) ' |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
255 "values ('foo', %(double)s, 'value');"%{'name': tablename, |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
256 'double': test_double} |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
257 ) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
258 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
259 self.db.cursor.execute('select %(name)s_time from %(name)ss ' |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
260 "where %(name)s_key = 'foo'"%{'name': tablename}) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
261 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
262 self.assertNotAlmostEqual(self.db.cursor.fetchone()[0], |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
263 test_double, -1) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
264 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
265 # cleanup or else the inserts after the upgrade will not |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
266 # work. |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
267 self.db.sql("delete from %(name)ss where %(name)s_key='foo'"%{ |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
268 'name': tablename} ) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
269 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
270 self.db.database_schema['version'] = 7 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
271 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
272 if hasattr(self,"downgrade_only"): |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
273 return |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
274 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
275 # test upgrade altering row |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
276 self.db.post_init() |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
277 |
|
7206
521d98231e5c
Test self.db.db_version_updated in schema upgrade paths
John Rouillard <rouilj@ieee.org>
parents:
6915
diff
changeset
|
278 self.assertEqual(self.db.db_version_updated, True) |
|
521d98231e5c
Test self.db.db_version_updated in schema upgrade paths
John Rouillard <rouilj@ieee.org>
parents:
6915
diff
changeset
|
279 |
|
6806
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
280 # verify they keep all signifcant digits before the decimal point |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
281 for tablename in ['otk', 'session']: |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
282 self.db.sql( |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
283 'insert into %(name)ss(%(name)s_key, %(name)s_time, %(name)s_value) ' |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
284 "values ('foo', %(double)s, 'value');"%{'name': tablename, |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
285 'double': test_double} |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
286 ) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
287 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
288 self.db.cursor.execute('select %(name)s_time from %(name)ss ' |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
289 "where %(name)s_key = 'foo'"%{'name': tablename}) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
290 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
291 self.assertAlmostEqual(self.db.cursor.fetchone()[0], |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
292 test_double, -1) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
293 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
294 self.assertEqual(self.db.database_schema['version'], 8) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
295 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
296 @skip_postgresql |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
297 class postgresqlDBTest(postgresqlOpener, DBTest, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
298 postgresqlAdditionalDBTest, unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
299 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
300 # set for manual integration testing of 'native-fts' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
301 # It is unset in tearDown so it doesn't leak into other tests. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
302 # FIXME extract test methods in DBTest that hit the indexer |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
303 # into a new class (DBTestIndexer). Add DBTestIndexer |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
304 # to this class. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
305 # Then create a new class in this file: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
306 # postgresqlDBTestIndexerNative_FTS |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
307 # that imports from DBestIndexer to test native-fts. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
308 # config['INDEXER'] = 'native-fts' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
309 postgresqlOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
310 DBTest.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
311 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
312 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
313 # clean up config to prevent leak if native-fts is tested |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
314 config['INDEXER'] = '' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
315 DBTest.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
316 postgresqlOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
317 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
318 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
319 @pytest.mark.pg_schema |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
320 class postgresqlDBTestSchema(postgresqlSchemaOpener, DBTest, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
321 postgresqlAdditionalDBTest, unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
322 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
323 # set for manual integration testing of 'native-fts' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
324 # It is unset in tearDown so it doesn't leak into other tests. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
325 # FIXME extract test methods in DBTest that hit the indexer |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
326 # into a new class (DBTestIndexer). Add DBTestIndexer |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
327 # to this class. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
328 # Then create a new class in this file: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
329 # postgresqlDBTestIndexerNative_FTS |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
330 # that imports from DBestIndexer to test native-fts. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
331 # config['INDEXER'] = 'native-fts' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
332 postgresqlSchemaOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
333 DBTest.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
334 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
335 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
336 # clean up config to prevent leak if native-fts is tested |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
337 config['INDEXER'] = '' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
338 DBTest.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
339 postgresqlSchemaOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
340 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
341 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
342 @skip_postgresql |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
343 class postgresqlROTest(postgresqlOpener, ROTest, unittest.TestCase): |
|
1906
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
344 def setUp(self): |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
345 postgresqlOpener.setUp(self) |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
346 ROTest.setUp(self) |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
347 |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
348 def tearDown(self): |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
349 ROTest.tearDown(self) |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
350 postgresqlOpener.tearDown(self) |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
351 |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
352 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
353 @pytest.mark.pg_schema |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
354 class postgresqlROTestSchema(postgresqlSchemaOpener, ROTest, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
355 unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
356 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
357 postgresqlSchemaOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
358 ROTest.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
359 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
360 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
361 ROTest.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
362 postgresqlSchemaOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
363 |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
364 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
365 @skip_postgresql |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
366 class postgresqlConcurrencyTest(postgresqlOpener, ConcurrentDBTest, |
|
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
367 unittest.TestCase): |
|
4448
2784c239e6c8
clear the cache on commit for rdbms backends:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3685
diff
changeset
|
368 backend = 'postgresql' |
|
2784c239e6c8
clear the cache on commit for rdbms backends:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3685
diff
changeset
|
369 def setUp(self): |
|
2784c239e6c8
clear the cache on commit for rdbms backends:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3685
diff
changeset
|
370 postgresqlOpener.setUp(self) |
|
2784c239e6c8
clear the cache on commit for rdbms backends:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3685
diff
changeset
|
371 ConcurrentDBTest.setUp(self) |
|
2784c239e6c8
clear the cache on commit for rdbms backends:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3685
diff
changeset
|
372 |
|
2784c239e6c8
clear the cache on commit for rdbms backends:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3685
diff
changeset
|
373 def tearDown(self): |
|
2784c239e6c8
clear the cache on commit for rdbms backends:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3685
diff
changeset
|
374 ConcurrentDBTest.tearDown(self) |
|
2784c239e6c8
clear the cache on commit for rdbms backends:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3685
diff
changeset
|
375 postgresqlOpener.tearDown(self) |
|
2784c239e6c8
clear the cache on commit for rdbms backends:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3685
diff
changeset
|
376 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
377 @skip_postgresql |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
378 @pytest.mark.pg_schema |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
379 class postgresqlConcurrencyTestSchema(postgresqlSchemaOpener, ConcurrentDBTest, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
380 unittest.TestCase): |
|
4887
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
381 backend = 'postgresql' |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
382 def setUp(self): |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
383 postgresqlSchemaOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
384 ConcurrentDBTest.setUp(self) |
|
4887
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
385 |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
386 def tearDown(self): |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
387 ConcurrentDBTest.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
388 postgresqlSchemaOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
389 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
390 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
391 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
392 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
393 class postgresqlAdditionalJournalTest(): |
|
4887
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
394 |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
395 def _test_journal(self, expected_journal): |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
396 id = self.id |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
397 db1 = self.db1 = self.tracker.open('admin') |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
398 db2 = self.db2 = self.tracker.open('admin') |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
399 |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
400 t1 = db1.issue.get(id, 'title') |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
401 t2 = db2.issue.get(id, 'title') |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
402 |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
403 db1.issue.set (id, title='t1') |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
404 db1.commit() |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
405 db1.close() |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
406 |
|
5118
57452bc6d989
issue2550853 - better error handling and cleanup on some postgres
John Rouillard <rouilj@ieee.org>
parents:
5109
diff
changeset
|
407 # Test testConcurrentRepeatableRead is expected to raise |
|
57452bc6d989
issue2550853 - better error handling and cleanup on some postgres
John Rouillard <rouilj@ieee.org>
parents:
5109
diff
changeset
|
408 # an error when the db2.issue.set() call is executed. |
|
57452bc6d989
issue2550853 - better error handling and cleanup on some postgres
John Rouillard <rouilj@ieee.org>
parents:
5109
diff
changeset
|
409 try: |
|
57452bc6d989
issue2550853 - better error handling and cleanup on some postgres
John Rouillard <rouilj@ieee.org>
parents:
5109
diff
changeset
|
410 db2.issue.set (id, title='t2') |
|
57452bc6d989
issue2550853 - better error handling and cleanup on some postgres
John Rouillard <rouilj@ieee.org>
parents:
5109
diff
changeset
|
411 db2.commit() |
|
57452bc6d989
issue2550853 - better error handling and cleanup on some postgres
John Rouillard <rouilj@ieee.org>
parents:
5109
diff
changeset
|
412 finally: |
|
57452bc6d989
issue2550853 - better error handling and cleanup on some postgres
John Rouillard <rouilj@ieee.org>
parents:
5109
diff
changeset
|
413 # Make sure that the db2 connection is closed, even when |
|
57452bc6d989
issue2550853 - better error handling and cleanup on some postgres
John Rouillard <rouilj@ieee.org>
parents:
5109
diff
changeset
|
414 # an error is raised. |
|
57452bc6d989
issue2550853 - better error handling and cleanup on some postgres
John Rouillard <rouilj@ieee.org>
parents:
5109
diff
changeset
|
415 db2.close() |
|
4887
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
416 self.db = self.tracker.open('admin') |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
417 journal = self.db.getjournal('issue', id) |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
418 for n, line in enumerate(journal): |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
419 self.assertEqual(line[4], expected_journal[n]) |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
420 |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
421 def testConcurrentReadCommitted(self): |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
422 expected_journal = [ |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
423 {}, {'title': 'initial value'}, {'title': 'initial value'} |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
424 ] |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
425 self._test_journal(expected_journal) |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
426 |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
427 def testConcurrentRepeatableRead(self): |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
428 self.tracker.config.RDBMS_ISOLATION_LEVEL='repeatable read' |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
429 exc = self.module.TransactionRollbackError |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
430 self.assertRaises(exc, self._test_journal, []) |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
431 |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
432 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
433 class postgresqlJournalTest(postgresqlOpener, ClassicInitBase, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
434 postgresqlAdditionalJournalTest, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
435 unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
436 backend = 'postgresql' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
437 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
438 postgresqlOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
439 ClassicInitBase.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
440 self.tracker = setupTracker(self.dirname, self.backend) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
441 db = self.tracker.open('admin') |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
442 self.id = db.issue.create(title='initial value') |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
443 db.commit() |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
444 db.close() |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
445 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
446 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
447 try: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
448 self.db1.close() |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
449 self.db2.close() |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
450 except psycopg2.InterfaceError as exc: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
451 if 'connection already closed' in str(exc): pass |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
452 else: raise |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
453 ClassicInitBase.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
454 postgresqlOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
455 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
456 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
457 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
458 @pytest.mark.pg_schema |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
459 class postgresqlJournalTestSchema(postgresqlSchemaOpener, ClassicInitBase, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
460 postgresqlAdditionalJournalTest, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
461 unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
462 backend = 'postgresql' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
463 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
464 postgresqlSchemaOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
465 ClassicInitBase.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
466 self.tracker = setupTracker(self.dirname, self.backend) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
467 db = self.tracker.open('admin') |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
468 self.id = db.issue.create(title='initial value') |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
469 db.commit() |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
470 db.close() |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
471 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
472 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
473 try: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
474 self.db1.close() |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
475 self.db2.close() |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
476 except psycopg2.InterfaceError as exc: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
477 if 'connection already closed' in str(exc): pass |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
478 else: raise |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
479 ClassicInitBase.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
480 postgresqlSchemaOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
481 |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
482 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
483 @skip_postgresql |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
484 class postgresqlHTMLItemTest(postgresqlOpener, HTMLItemTest, |
|
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
485 unittest.TestCase): |
|
4878
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
486 backend = 'postgresql' |
|
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
487 def setUp(self): |
|
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
488 postgresqlOpener.setUp(self) |
|
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
489 HTMLItemTest.setUp(self) |
|
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
490 |
|
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
491 def tearDown(self): |
|
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
492 HTMLItemTest.tearDown(self) |
|
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
493 postgresqlOpener.tearDown(self) |
|
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
494 |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
495 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
496 @skip_postgresql |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
497 @pytest.mark.pg_schema |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
498 class postgresqlHTMLItemTestSchema(postgresqlSchemaOpener, HTMLItemTest, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
499 unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
500 backend = 'postgresql' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
501 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
502 postgresqlSchemaOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
503 HTMLItemTest.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
504 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
505 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
506 HTMLItemTest.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
507 postgresqlSchemaOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
508 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
509 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
510 @skip_postgresql |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
511 class postgresqlFilterCacheTest(postgresqlOpener, FilterCacheTest, |
|
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
512 unittest.TestCase): |
|
4472
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
513 backend = 'postgresql' |
|
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
514 def setUp(self): |
|
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
515 postgresqlOpener.setUp(self) |
|
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
516 FilterCacheTest.setUp(self) |
|
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
517 |
|
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
518 def tearDown(self): |
|
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
519 FilterCacheTest.tearDown(self) |
|
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
520 postgresqlOpener.tearDown(self) |
|
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
521 |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
522 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
523 @pytest.mark.pg_schema |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
524 class postgresqlFilterCacheTestSchema(postgresqlSchemaOpener, FilterCacheTest, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
525 unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
526 backend = 'postgresql' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
527 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
528 postgresqlSchemaOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
529 FilterCacheTest.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
530 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
531 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
532 FilterCacheTest.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
533 postgresqlSchemaOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
534 |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
535 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
536 @skip_postgresql |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
537 class postgresqlSchemaTest(postgresqlOpener, SchemaTest, unittest.TestCase): |
|
1906
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
538 def setUp(self): |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
539 postgresqlOpener.setUp(self) |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
540 SchemaTest.setUp(self) |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
541 |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
542 def tearDown(self): |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
543 SchemaTest.tearDown(self) |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
544 postgresqlOpener.tearDown(self) |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
545 |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
546 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
547 @skip_postgresql |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
548 @pytest.mark.pg_schema |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
549 class postgresqlSchemaTestSchema(postgresqlSchemaOpener, SchemaTest, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
550 unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
551 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
552 postgresqlSchemaOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
553 SchemaTest.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
554 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
555 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
556 SchemaTest.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
557 postgresqlSchemaOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
558 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
559 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
560 @skip_postgresql |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
561 class postgresqlClassicInitTest(postgresqlOpener, ClassicInitTest, |
|
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
562 unittest.TestCase): |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
563 backend = 'postgresql' |
|
1906
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
564 def setUp(self): |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
565 postgresqlOpener.setUp(self) |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
566 ClassicInitTest.setUp(self) |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
567 |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
568 def tearDown(self): |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
569 ClassicInitTest.tearDown(self) |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
570 postgresqlOpener.tearDown(self) |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
571 |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
572 |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
573 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
574 @pytest.mark.pg_schema |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
575 class postgresqlClassicInitTestSchema(postgresqlSchemaOpener, ClassicInitTest, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
576 unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
577 backend = 'postgresql' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
578 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
579 postgresqlSchemaOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
580 ClassicInitTest.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
581 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
582 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
583 ClassicInitTest.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
584 postgresqlSchemaOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
585 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
586 |
|
5388
d26921b851c3
Python 3 preparation: make relative imports explicit.
Joseph Myers <jsm@polyomino.org.uk>
parents:
5319
diff
changeset
|
587 from .session_common import SessionTest |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
588 @skip_postgresql |
|
5319
62de601bdf6f
Fix commits although a Reject exception is raised
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5310
diff
changeset
|
589 class postgresqlSessionTest(postgresqlOpener, SessionTest, unittest.TestCase): |
|
6805
09d9c646ca89
Put in missing s2b needed for session list test.
John Rouillard <rouilj@ieee.org>
parents:
6622
diff
changeset
|
590 s2b = lambda x,y : y |
|
09d9c646ca89
Put in missing s2b needed for session list test.
John Rouillard <rouilj@ieee.org>
parents:
6622
diff
changeset
|
591 |
|
2082
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
2075
diff
changeset
|
592 def setUp(self): |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
2075
diff
changeset
|
593 postgresqlOpener.setUp(self) |
|
5319
62de601bdf6f
Fix commits although a Reject exception is raised
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5310
diff
changeset
|
594 SessionTest.setUp(self) |
|
2082
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
2075
diff
changeset
|
595 def tearDown(self): |
|
5319
62de601bdf6f
Fix commits although a Reject exception is raised
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5310
diff
changeset
|
596 SessionTest.tearDown(self) |
|
2082
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
2075
diff
changeset
|
597 postgresqlOpener.tearDown(self) |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
2075
diff
changeset
|
598 |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
599 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
600 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
601 @pytest.mark.pg_schema |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
602 class postgresqlSessionTestSchema(postgresqlSchemaOpener, SessionTest, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
603 unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
604 s2b = lambda x,y : y |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
605 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
606 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
607 postgresqlSchemaOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
608 SessionTest.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
609 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
610 SessionTest.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
611 postgresqlSchemaOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
612 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
613 |
|
5310
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5248
diff
changeset
|
614 @skip_postgresql |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5248
diff
changeset
|
615 class postgresqlSpecialActionTestCase(postgresqlOpener, SpecialActionTest, |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5248
diff
changeset
|
616 unittest.TestCase): |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5248
diff
changeset
|
617 backend = 'postgresql' |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5248
diff
changeset
|
618 def setUp(self): |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5248
diff
changeset
|
619 postgresqlOpener.setUp(self) |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5248
diff
changeset
|
620 SpecialActionTest.setUp(self) |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5248
diff
changeset
|
621 |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5248
diff
changeset
|
622 def tearDown(self): |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5248
diff
changeset
|
623 SpecialActionTest.tearDown(self) |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5248
diff
changeset
|
624 postgresqlOpener.tearDown(self) |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5248
diff
changeset
|
625 |
|
5601
fcbeff272828
Integrate REST tests into db framework
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5388
diff
changeset
|
626 @skip_postgresql |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
627 @pytest.mark.pg_schema |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
628 class postgresqlSpecialActionTestCaseSchema(postgresqlSchemaOpener, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
629 SpecialActionTest, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
630 unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
631 backend = 'postgresql' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
632 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
633 postgresqlSchemaOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
634 SpecialActionTest.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
635 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
636 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
637 SpecialActionTest.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
638 postgresqlSchemaOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
639 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
640 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
641 class postgresqlRestTest (postgresqlOpener, RestTestCase, unittest.TestCase): |
|
5601
fcbeff272828
Integrate REST tests into db framework
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5388
diff
changeset
|
642 backend = 'postgresql' |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
643 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
644 postgresqlOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
645 RestTestCase.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
646 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
647 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
648 RestTestCase.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
649 postgresqlOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
650 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
651 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
652 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
653 @pytest.mark.pg_schema |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
654 class postgresqlRestTestSchema(postgresqlSchemaOpener, RestTestCase, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
655 unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
656 backend = 'postgresql' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
657 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
658 postgresqlSchemaOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
659 RestTestCase.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
660 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
661 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
662 RestTestCase.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
663 postgresqlSchemaOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
664 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
665 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
666 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
667 @pytest.mark.pg_schema |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
668 class postgresqlDbDropFailureTestSchema(postgresqlPrecreatedSchemaDbOpener, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
669 unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
670 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
671 def test_drop(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
672 """Verify that the schema test database can not be dropped.""" |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
673 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
674 with self.assertRaises(RuntimeError) as m: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
675 self.module.db_nuke(config) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
676 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
677 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
678 self.assertEqual(m.exception.args[0], |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
679 'must be owner of database rounduptest_schema') |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
680 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
681 |
|
5601
fcbeff272828
Integrate REST tests into db framework
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5388
diff
changeset
|
682 |
|
2682
93c58a68061b
rdbms settings are now common for all backends.
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2358
diff
changeset
|
683 # vim: set et sts=4 sw=4 : |
