Mercurial > p > roundup > code
annotate test/test_mysql.py @ 7035:edaf7086cb2e
flake8 E228 missing whitespace around modulo operator
plus some indenting fixes to realign lines.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Mon, 10 Oct 2022 14:41:11 -0400 |
| parents | bdd28b244839 |
| children | 521d98231e5c |
| 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 |
|
6300
778a9f455067
Remove old code import imp, old style trackers db/backend_name
John Rouillard <rouilj@ieee.org>
parents:
5916
diff
changeset
|
18 import unittest, os, shutil, time |
|
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 |
|
2856
adec352e2ce0
don't try to import all backends in backends.__init__ unless we *want* to
Richard Jones <richard@users.sourceforge.net>
parents:
2694
diff
changeset
|
22 from roundup.backends import get_backend, have_backend |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
23 |
|
5388
d26921b851c3
Python 3 preparation: make relative imports explicit.
Joseph Myers <jsm@polyomino.org.uk>
parents:
5319
diff
changeset
|
24 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
|
25 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
|
26 from .db_test_base import SpecialActionTest |
|
5601
fcbeff272828
Integrate REST tests into db framework
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5388
diff
changeset
|
27 from .rest_common import TestCase as RestTestCase |
|
1906
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1898
diff
changeset
|
28 |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1898
diff
changeset
|
29 |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
30 class mysqlOpener: |
|
2856
adec352e2ce0
don't try to import all backends in backends.__init__ unless we *want* to
Richard Jones <richard@users.sourceforge.net>
parents:
2694
diff
changeset
|
31 if have_backend('mysql'): |
|
2892
2eae5848912d
always honor indexme property on Strings (patch [SF#063711])
Richard Jones <richard@users.sourceforge.net>
parents:
2856
diff
changeset
|
32 module = get_backend('mysql') |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
33 |
|
2075
b1704ba7be41
make mysql / postgresql work again. beginnings of otk/session store in rdbmses
Richard Jones <richard@users.sourceforge.net>
parents:
1920
diff
changeset
|
34 def setUp(self): |
|
b1704ba7be41
make mysql / postgresql work again. beginnings of otk/session store in rdbmses
Richard Jones <richard@users.sourceforge.net>
parents:
1920
diff
changeset
|
35 self.module.db_nuke(config) |
|
b1704ba7be41
make mysql / postgresql work again. beginnings of otk/session store in rdbmses
Richard Jones <richard@users.sourceforge.net>
parents:
1920
diff
changeset
|
36 |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
37 def tearDown(self): |
|
5916
6b4857686365
revert code to try to debug issue2551025
John Rouillard <rouilj@ieee.org>
parents:
5915
diff
changeset
|
38 self.db.close() |
|
1920
f9316d2cd5ba
Fixed retirement of items in rdbms imports [SF#841355]
Richard Jones <richard@users.sourceforge.net>
parents:
1906
diff
changeset
|
39 self.nuke_database() |
|
f9316d2cd5ba
Fixed retirement of items in rdbms imports [SF#841355]
Richard Jones <richard@users.sourceforge.net>
parents:
1906
diff
changeset
|
40 |
|
f9316d2cd5ba
Fixed retirement of items in rdbms imports [SF#841355]
Richard Jones <richard@users.sourceforge.net>
parents:
1906
diff
changeset
|
41 def nuke_database(self): |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
42 self.module.db_nuke(config) |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
43 |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4878
diff
changeset
|
44 |
|
5109
43a1f7fe39f5
Improved work-around for pytest markers bug
John Kristensen <john@jerrykan.com>
parents:
5105
diff
changeset
|
45 # FIX: workaround for a bug in pytest.mark.skip(): |
|
5038
c977f3530944
Work-around for pytest.mark.skipif() bug
John Kristensen <john@jerrykan.com>
parents:
5037
diff
changeset
|
46 # https://github.com/pytest-dev/pytest/issues/568 |
|
5109
43a1f7fe39f5
Improved work-around for pytest markers bug
John Kristensen <john@jerrykan.com>
parents:
5105
diff
changeset
|
47 from .pytest_patcher import mark_class |
|
43a1f7fe39f5
Improved work-around for pytest markers bug
John Kristensen <john@jerrykan.com>
parents:
5105
diff
changeset
|
48 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
49 if not have_backend('mysql'): |
|
5109
43a1f7fe39f5
Improved work-around for pytest markers bug
John Kristensen <john@jerrykan.com>
parents:
5105
diff
changeset
|
50 skip_mysql = mark_class(pytest.mark.skip( |
|
43a1f7fe39f5
Improved work-around for pytest markers bug
John Kristensen <john@jerrykan.com>
parents:
5105
diff
changeset
|
51 reason='Skipping MySQL 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
|
52 else: |
|
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
53 try: |
|
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
54 import MySQLdb |
|
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
55 mysqlOpener.module.db_exists(config) |
|
5038
c977f3530944
Work-around for pytest.mark.skipif() bug
John Kristensen <john@jerrykan.com>
parents:
5037
diff
changeset
|
56 skip_mysql = lambda func, *args, **kwargs: func |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
57 except (MySQLdb.MySQLError, DatabaseError) as msg: |
|
5109
43a1f7fe39f5
Improved work-around for pytest markers bug
John Kristensen <john@jerrykan.com>
parents:
5105
diff
changeset
|
58 skip_mysql = mark_class(pytest.mark.skip( |
|
43a1f7fe39f5
Improved work-around for pytest markers bug
John Kristensen <john@jerrykan.com>
parents:
5105
diff
changeset
|
59 reason='Skipping MySQL tests: %s' % str(msg))) |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
60 |
|
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
61 |
|
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
62 @skip_mysql |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4878
diff
changeset
|
63 class mysqlDBTest(mysqlOpener, DBTest, unittest.TestCase): |
|
2075
b1704ba7be41
make mysql / postgresql work again. beginnings of otk/session store in rdbmses
Richard Jones <richard@users.sourceforge.net>
parents:
1920
diff
changeset
|
64 def setUp(self): |
|
b1704ba7be41
make mysql / postgresql work again. beginnings of otk/session store in rdbmses
Richard Jones <richard@users.sourceforge.net>
parents:
1920
diff
changeset
|
65 mysqlOpener.setUp(self) |
|
b1704ba7be41
make mysql / postgresql work again. beginnings of otk/session store in rdbmses
Richard Jones <richard@users.sourceforge.net>
parents:
1920
diff
changeset
|
66 DBTest.setUp(self) |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
67 |
|
6599
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
68 def testUpgrade_6_to_7(self): |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
69 |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
70 # load the database |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
71 self.db.issue.create(title="flebble frooz") |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
72 self.db.commit() |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
73 |
|
6806
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
74 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
|
75 # 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
|
76 if hasattr(self, "downgrade_only"): |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
77 # 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
|
78 self.testUpgrade_7_to_8() |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
79 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
|
80 else: |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
81 # we are being called directly |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
82 self.downgrade_only = True |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
83 self.testUpgrade_7_to_8() |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
84 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
|
85 del(self.downgrade_only) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
86 elif self.db.database_schema['version'] != 7: |
|
6599
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
87 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:
6300
diff
changeset
|
88 |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
89 |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
90 # test by shrinking _words and trying to insert a long value |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
91 # it should fail. |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
92 # run post-init |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
93 # same test should succeed. |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
94 |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
95 self.db.sql("alter table __words change column " |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
96 "_word _word varchar(10)") |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
97 |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
98 long_string = "a" * (self.db.indexer.maxlength + 5) |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
99 |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
100 with self.assertRaises(MySQLdb.DataError) as ctx: |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
101 # DataError : Data too long for column '_word' at row 1 |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
102 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:
6300
diff
changeset
|
103 |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
104 self.assertIn("Data too long for column '_word'", |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
105 ctx.exception.args[1]) |
|
6604
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
106 |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
107 self.db.database_schema['version'] = 6 |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
108 |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
109 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
|
110 return |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
111 |
|
6599
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
112 # test upgrade altering row |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
113 self.db.post_init() |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
114 |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
115 # 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:
6300
diff
changeset
|
116 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:
6300
diff
changeset
|
117 |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
118 # 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:
6300
diff
changeset
|
119 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:
6300
diff
changeset
|
120 with self.assertRaises(MySQLdb.DataError) as ctx: |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
6300
diff
changeset
|
121 self.db.sql("insert into __words VALUES('%s',1)" % too_long_string) |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4878
diff
changeset
|
122 |
|
6604
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
123 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
|
124 self.db.current_db_version) |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
125 |
|
6806
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
126 def testUpgrade_7_to_8(self): |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
127 # load the database |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
128 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
|
129 self.db.commit() |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
130 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
131 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
|
132 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
|
133 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
134 # 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
|
135 sql = "alter table sessions modify session_time float;" |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
136 self.db.sql(sql) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
137 sql = "alter table otks modify otk_time float;" |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
138 self.db.sql(sql) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
139 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
140 # verify they truncate long ints. |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
141 test_double = 1658718284.7616878 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
142 for tablename in ['otk', 'session']: |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
143 self.db.sql( |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
144 'insert %(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
|
145 '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
|
146 'double': test_double} |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
147 ) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
148 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
149 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
|
150 '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
|
151 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
152 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
|
153 test_double, -1) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
154 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
155 # 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
|
156 # work. |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
157 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
|
158 'name': tablename} ) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
159 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
160 self.db.database_schema['version'] = 7 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
161 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
162 if hasattr(self,"downgrade_only"): |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
163 return |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
164 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
165 # test upgrade |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
166 self.db.post_init() |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
167 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
168 # 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
|
169 for tablename in ['otk', 'session']: |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
170 self.db.sql( |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
171 'insert %(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
|
172 '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
|
173 'double': test_double} |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
174 ) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
175 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
176 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
|
177 '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
|
178 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
179 # -1 compares just the integer part. No fractions. |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
180 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
|
181 test_double, -1) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
182 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
183 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
|
184 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
185 @skip_mysql |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4878
diff
changeset
|
186 class mysqlROTest(mysqlOpener, ROTest, unittest.TestCase): |
|
2075
b1704ba7be41
make mysql / postgresql work again. beginnings of otk/session store in rdbmses
Richard Jones <richard@users.sourceforge.net>
parents:
1920
diff
changeset
|
187 def setUp(self): |
|
b1704ba7be41
make mysql / postgresql work again. beginnings of otk/session store in rdbmses
Richard Jones <richard@users.sourceforge.net>
parents:
1920
diff
changeset
|
188 mysqlOpener.setUp(self) |
|
b1704ba7be41
make mysql / postgresql work again. beginnings of otk/session store in rdbmses
Richard Jones <richard@users.sourceforge.net>
parents:
1920
diff
changeset
|
189 ROTest.setUp(self) |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
190 |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4878
diff
changeset
|
191 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
192 @skip_mysql |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4878
diff
changeset
|
193 class mysqlSchemaTest(mysqlOpener, SchemaTest, unittest.TestCase): |
|
2075
b1704ba7be41
make mysql / postgresql work again. beginnings of otk/session store in rdbmses
Richard Jones <richard@users.sourceforge.net>
parents:
1920
diff
changeset
|
194 def setUp(self): |
|
b1704ba7be41
make mysql / postgresql work again. beginnings of otk/session store in rdbmses
Richard Jones <richard@users.sourceforge.net>
parents:
1920
diff
changeset
|
195 mysqlOpener.setUp(self) |
|
b1704ba7be41
make mysql / postgresql work again. beginnings of otk/session store in rdbmses
Richard Jones <richard@users.sourceforge.net>
parents:
1920
diff
changeset
|
196 SchemaTest.setUp(self) |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
197 |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4878
diff
changeset
|
198 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
199 @skip_mysql |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4878
diff
changeset
|
200 class mysqlClassicInitTest(mysqlOpener, ClassicInitTest, unittest.TestCase): |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
201 backend = 'mysql' |
|
2075
b1704ba7be41
make mysql / postgresql work again. beginnings of otk/session store in rdbmses
Richard Jones <richard@users.sourceforge.net>
parents:
1920
diff
changeset
|
202 def setUp(self): |
|
b1704ba7be41
make mysql / postgresql work again. beginnings of otk/session store in rdbmses
Richard Jones <richard@users.sourceforge.net>
parents:
1920
diff
changeset
|
203 mysqlOpener.setUp(self) |
|
b1704ba7be41
make mysql / postgresql work again. beginnings of otk/session store in rdbmses
Richard Jones <richard@users.sourceforge.net>
parents:
1920
diff
changeset
|
204 ClassicInitTest.setUp(self) |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
205 def tearDown(self): |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
206 ClassicInitTest.tearDown(self) |
|
1920
f9316d2cd5ba
Fixed retirement of items in rdbms imports [SF#841355]
Richard Jones <richard@users.sourceforge.net>
parents:
1906
diff
changeset
|
207 self.nuke_database() |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
208 |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4878
diff
changeset
|
209 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
210 @skip_mysql |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4878
diff
changeset
|
211 class mysqlConcurrencyTest(mysqlOpener, ConcurrentDBTest, unittest.TestCase): |
|
4448
2784c239e6c8
clear the cache on commit for rdbms backends:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
2892
diff
changeset
|
212 backend = 'mysql' |
|
2784c239e6c8
clear the cache on commit for rdbms backends:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
2892
diff
changeset
|
213 def setUp(self): |
|
2784c239e6c8
clear the cache on commit for rdbms backends:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
2892
diff
changeset
|
214 mysqlOpener.setUp(self) |
|
4472
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
215 ConcurrentDBTest.setUp(self) |
|
4448
2784c239e6c8
clear the cache on commit for rdbms backends:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
2892
diff
changeset
|
216 def tearDown(self): |
|
4472
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
217 ConcurrentDBTest.tearDown(self) |
|
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
218 self.nuke_database() |
|
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
219 |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4878
diff
changeset
|
220 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
221 @skip_mysql |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4878
diff
changeset
|
222 class mysqlHTMLItemTest(mysqlOpener, HTMLItemTest, unittest.TestCase): |
|
4878
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
223 backend = 'mysql' |
|
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
224 def setUp(self): |
|
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
225 mysqlOpener.setUp(self) |
|
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
226 HTMLItemTest.setUp(self) |
|
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
227 def tearDown(self): |
|
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
228 HTMLItemTest.tearDown(self) |
|
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
229 self.nuke_database() |
|
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
230 |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4878
diff
changeset
|
231 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
232 @skip_mysql |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4878
diff
changeset
|
233 class mysqlFilterCacheTest(mysqlOpener, FilterCacheTest, unittest.TestCase): |
|
4472
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
234 backend = 'mysql' |
|
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
235 def setUp(self): |
|
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
236 mysqlOpener.setUp(self) |
|
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
237 FilterCacheTest.setUp(self) |
|
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
238 def tearDown(self): |
|
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
239 FilterCacheTest.tearDown(self) |
|
4448
2784c239e6c8
clear the cache on commit for rdbms backends:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
2892
diff
changeset
|
240 self.nuke_database() |
|
2784c239e6c8
clear the cache on commit for rdbms backends:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
2892
diff
changeset
|
241 |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4878
diff
changeset
|
242 |
|
5388
d26921b851c3
Python 3 preparation: make relative imports explicit.
Joseph Myers <jsm@polyomino.org.uk>
parents:
5319
diff
changeset
|
243 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
|
244 @skip_mysql |
|
5319
62de601bdf6f
Fix commits although a Reject exception is raised
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5310
diff
changeset
|
245 class mysqlSessionTest(mysqlOpener, SessionTest, unittest.TestCase): |
|
6805
09d9c646ca89
Put in missing s2b needed for session list test.
John Rouillard <rouilj@ieee.org>
parents:
6604
diff
changeset
|
246 s2b = lambda x,y : y |
|
09d9c646ca89
Put in missing s2b needed for session list test.
John Rouillard <rouilj@ieee.org>
parents:
6604
diff
changeset
|
247 |
|
2082
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
2075
diff
changeset
|
248 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
|
249 mysqlOpener.setUp(self) |
|
5319
62de601bdf6f
Fix commits although a Reject exception is raised
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5310
diff
changeset
|
250 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
|
251 def tearDown(self): |
|
5319
62de601bdf6f
Fix commits although a Reject exception is raised
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5310
diff
changeset
|
252 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
|
253 mysqlOpener.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
|
254 |
|
5310
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5109
diff
changeset
|
255 @skip_mysql |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5109
diff
changeset
|
256 class mysqlSpecialActionTestCase(mysqlOpener, SpecialActionTest, |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5109
diff
changeset
|
257 unittest.TestCase): |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5109
diff
changeset
|
258 backend = 'mysql' |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5109
diff
changeset
|
259 def setUp(self): |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5109
diff
changeset
|
260 mysqlOpener.setUp(self) |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5109
diff
changeset
|
261 SpecialActionTest.setUp(self) |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5109
diff
changeset
|
262 |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5109
diff
changeset
|
263 def tearDown(self): |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5109
diff
changeset
|
264 SpecialActionTest.tearDown(self) |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5109
diff
changeset
|
265 mysqlOpener.tearDown(self) |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5109
diff
changeset
|
266 |
|
5601
fcbeff272828
Integrate REST tests into db framework
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5388
diff
changeset
|
267 @skip_mysql |
|
fcbeff272828
Integrate REST tests into db framework
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5388
diff
changeset
|
268 class mysqlRestTest (RestTestCase, unittest.TestCase): |
|
fcbeff272828
Integrate REST tests into db framework
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5388
diff
changeset
|
269 backend = 'mysql' |
|
fcbeff272828
Integrate REST tests into db framework
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5388
diff
changeset
|
270 |
|
2681
1a335e3c9589
rdbms settings are now common for all backends.
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2358
diff
changeset
|
271 # vim: set et sts=4 sw=4 : |
