openmodule-test 13.1.4__tar.gz → 13.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/ChangeLog +13 -26
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/PKG-INFO +1 -1
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/connection_status.py +3 -0
- openmodule_test-13.3.0/database.py +137 -0
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/openmodule_test.egg-info/PKG-INFO +1 -1
- openmodule_test-13.3.0/openmodule_test.egg-info/pbr.json +1 -0
- openmodule_test-13.1.4/database.py +0 -71
- openmodule_test-13.1.4/openmodule_test.egg-info/pbr.json +0 -1
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/AUTHORS +0 -0
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/__init__.py +0 -0
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/alert.py +0 -0
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/core.py +0 -0
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/eventlistener.py +0 -0
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/files.py +0 -0
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/gate.py +0 -0
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/health.py +0 -0
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/interrupt.py +0 -0
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/io_simulator.py +0 -0
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/openmodule_test.egg-info/SOURCES.txt +0 -0
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/openmodule_test.egg-info/dependency_links.txt +0 -0
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/openmodule_test.egg-info/not-zip-safe +0 -0
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/openmodule_test.egg-info/requires.txt +0 -0
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/openmodule_test.egg-info/top_level.txt +0 -0
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/package_reader.py +0 -0
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/presence.py +0 -0
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/requirements.txt +0 -0
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/rpc.py +0 -0
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/settings.py +0 -0
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/setup.cfg +0 -0
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/setup.py +0 -0
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/utils.py +0 -0
- {openmodule_test-13.1.4 → openmodule_test-13.3.0}/zeromq.py +0 -0
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
CHANGES
|
|
2
2
|
=======
|
|
3
3
|
|
|
4
|
+
v13.3.0
|
|
5
|
+
-------
|
|
6
|
+
|
|
7
|
+
* [OM-359] cleanup helper function
|
|
8
|
+
|
|
9
|
+
v13.2.0
|
|
10
|
+
-------
|
|
11
|
+
|
|
12
|
+
* OM 187 Alembic migration test mixin
|
|
13
|
+
* add a testcase for expiring session data while adding new models (noticed in OM-327)
|
|
14
|
+
* Aktualisierung der Dokumentation
|
|
15
|
+
* OM-255
|
|
16
|
+
|
|
4
17
|
v13.1.4
|
|
5
18
|
-------
|
|
6
19
|
|
|
@@ -145,27 +158,6 @@ v11.1.0.rc4
|
|
|
145
158
|
|
|
146
159
|
* arivo-schedule in public pip
|
|
147
160
|
* use temporary arivo-schedule package
|
|
148
|
-
|
|
149
|
-
v11.1.0.rc3
|
|
150
|
-
-----------
|
|
151
|
-
|
|
152
|
-
* changed docs and requirements for schedule library until its a pip package
|
|
153
|
-
|
|
154
|
-
v11.1.0.rc2
|
|
155
|
-
-----------
|
|
156
|
-
|
|
157
|
-
* added fork of schedule package
|
|
158
|
-
|
|
159
|
-
v11.1.0.rc1
|
|
160
|
-
-----------
|
|
161
|
-
|
|
162
|
-
* databox upload now can have dst as folder (endswith "/")
|
|
163
|
-
|
|
164
|
-
v11.1.0.rc0
|
|
165
|
-
-----------
|
|
166
|
-
|
|
167
|
-
* fixed testcase
|
|
168
|
-
* small changes in csv export and databox upload adding more testcases docs
|
|
169
161
|
* removed mock rpcs from schema
|
|
170
162
|
|
|
171
163
|
v11.0.3
|
|
@@ -226,8 +218,3 @@ v10.0.1
|
|
|
226
218
|
v10.0.0
|
|
227
219
|
-------
|
|
228
220
|
|
|
229
|
-
* v10
|
|
230
|
-
* README Update for creation of dist structure [skip ci]
|
|
231
|
-
* don't schedule any more rpc's if we are already shutdown
|
|
232
|
-
* Update README.md
|
|
233
|
-
* Update README.md
|
|
@@ -30,6 +30,9 @@ class ConnectionStatusMocker:
|
|
|
30
30
|
def get_bridge(self) -> BridgeStatus:
|
|
31
31
|
return self._status.bridge_status
|
|
32
32
|
|
|
33
|
+
def check_timeout(self) -> None:
|
|
34
|
+
return None
|
|
35
|
+
|
|
33
36
|
def change_status(self, status: ConnectionRPCResponse):
|
|
34
37
|
self._previous_status = self._status
|
|
35
38
|
self._status = status
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import shutil
|
|
3
|
+
from glob import glob
|
|
4
|
+
from unittest import TestCase
|
|
5
|
+
|
|
6
|
+
from alembic import command
|
|
7
|
+
from alembic.runtime.migration import MigrationContext
|
|
8
|
+
from sqlalchemy import MetaData
|
|
9
|
+
from sqlalchemy.ext.automap import automap_base
|
|
10
|
+
|
|
11
|
+
from openmodule.config import settings
|
|
12
|
+
from openmodule.database.database import Database, database_path, alembic_config
|
|
13
|
+
|
|
14
|
+
_first_start = True
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def truncate_all_tables(database: Database, keep=("alembic_version",)):
|
|
18
|
+
assert any(x in database.db_folder for x in ["/test/"]), "deleting all tables is only for testing"
|
|
19
|
+
metadata = MetaData(bind=database._engine)
|
|
20
|
+
metadata.reflect()
|
|
21
|
+
with database._engine.connect() as con:
|
|
22
|
+
trans = con.begin()
|
|
23
|
+
for table in reversed(metadata.sorted_tables):
|
|
24
|
+
if table.name not in keep:
|
|
25
|
+
con.execute(table.delete())
|
|
26
|
+
trans.commit()
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class SQLiteTestMixin(TestCase):
|
|
30
|
+
"""
|
|
31
|
+
Mixin for database cleanup in test cases
|
|
32
|
+
* use create_database = True for an automatic generation of a database
|
|
33
|
+
* use create_database = False and set the database directly
|
|
34
|
+
"""
|
|
35
|
+
create_database = True
|
|
36
|
+
database = None
|
|
37
|
+
database_folder: str = None # defaults to settings.DATABASE_FOLDER
|
|
38
|
+
alembic_path = "../src/database"
|
|
39
|
+
database_name = "database"
|
|
40
|
+
|
|
41
|
+
@classmethod
|
|
42
|
+
def get_database_folder(cls):
|
|
43
|
+
return cls.database_folder or settings.DATABASE_FOLDER
|
|
44
|
+
|
|
45
|
+
@classmethod
|
|
46
|
+
def setUpClass(cls) -> None:
|
|
47
|
+
# we only know which databases are in use on tear down, so truncating only works in teardown
|
|
48
|
+
# but in order to not be annoyed by failed tests which left broken databases, we delete all databases
|
|
49
|
+
# once initially
|
|
50
|
+
global _first_start
|
|
51
|
+
if _first_start:
|
|
52
|
+
for file in glob(os.path.join(cls.get_database_folder(), "*.sqlite3")):
|
|
53
|
+
os.unlink(file)
|
|
54
|
+
_first_start = False
|
|
55
|
+
if cls.create_database:
|
|
56
|
+
cls.database = Database(cls.get_database_folder(), cls.database_name, cls.alembic_path)
|
|
57
|
+
return super().setUpClass()
|
|
58
|
+
|
|
59
|
+
@staticmethod
|
|
60
|
+
def delete_database(database: Database):
|
|
61
|
+
assert not database.is_open(), "database must be shutdown before it can be deleted"
|
|
62
|
+
try:
|
|
63
|
+
os.unlink(database_path(database.db_folder, database.name))
|
|
64
|
+
except FileNotFoundError:
|
|
65
|
+
pass
|
|
66
|
+
|
|
67
|
+
def tearDown(self):
|
|
68
|
+
super().tearDown()
|
|
69
|
+
if self.create_database:
|
|
70
|
+
truncate_all_tables(self.database)
|
|
71
|
+
|
|
72
|
+
@classmethod
|
|
73
|
+
def tearDownClass(cls):
|
|
74
|
+
if cls.create_database:
|
|
75
|
+
cls.database.shutdown()
|
|
76
|
+
os.unlink(database_path(cls.get_database_folder(), cls.database_name))
|
|
77
|
+
super().tearDownClass()
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class AlembicMigrationTestMixin(SQLiteTestMixin):
|
|
81
|
+
"""
|
|
82
|
+
Mixin for testing alembic migrations (up & down)
|
|
83
|
+
**DO NOT** import your database models in migration testcases, as the Models don't necessarily
|
|
84
|
+
match the database schema.
|
|
85
|
+
Set existing_database to the *.sqlite3 file you want to use for testing. **DO NOT** place your test database
|
|
86
|
+
in the <project_root>/sqlite/ folder, as it will be deleted in some cases.
|
|
87
|
+
This will copy the existing_database to the test database folder to ensure that the database is not modified.
|
|
88
|
+
create_database must be set to True, otherwise it is assumed that the programmer manages the database themselves.
|
|
89
|
+
"""
|
|
90
|
+
existing_database = None
|
|
91
|
+
|
|
92
|
+
def setUp(self):
|
|
93
|
+
self.base = automap_base()
|
|
94
|
+
if self.create_database:
|
|
95
|
+
if self.existing_database:
|
|
96
|
+
shutil.copyfile(self.existing_database, database_path(self.get_database_folder(), self.database_name))
|
|
97
|
+
else:
|
|
98
|
+
metadata = MetaData()
|
|
99
|
+
metadata.reflect(bind=self.connection)
|
|
100
|
+
metadata.drop_all(bind=self.connection)
|
|
101
|
+
super().setUp()
|
|
102
|
+
if self.database:
|
|
103
|
+
self.reload_models()
|
|
104
|
+
|
|
105
|
+
@property
|
|
106
|
+
def connection(self):
|
|
107
|
+
return self.database._engine
|
|
108
|
+
|
|
109
|
+
def reload_models(self):
|
|
110
|
+
self.base = automap_base()
|
|
111
|
+
self.base.prepare(self.connection, reflect=True)
|
|
112
|
+
|
|
113
|
+
def alembic_config(self):
|
|
114
|
+
alembic_path = self.alembic_path or os.path.join(os.getcwd(), "database")
|
|
115
|
+
assert os.path.exists(
|
|
116
|
+
os.path.abspath(alembic_path)), f"alembic path {os.path.abspath(alembic_path)} does not exist"
|
|
117
|
+
return alembic_config(self.connection, alembic_path)
|
|
118
|
+
|
|
119
|
+
def migrate_up(self, revision="head"):
|
|
120
|
+
config = self.alembic_config()
|
|
121
|
+
command.upgrade(config, revision)
|
|
122
|
+
assert self.connection.execute("PRAGMA foreign_keys").fetchone()[0] == 1, "foreign keys are not enabled"
|
|
123
|
+
self.reload_models()
|
|
124
|
+
|
|
125
|
+
def migrate_down(self, revision="base"):
|
|
126
|
+
config = self.alembic_config()
|
|
127
|
+
command.downgrade(config, revision)
|
|
128
|
+
assert self.connection.execute("PRAGMA foreign_keys").fetchone()[0] == 1, "foreign keys are not enabled"
|
|
129
|
+
self.reload_models()
|
|
130
|
+
|
|
131
|
+
def current_revision(self):
|
|
132
|
+
with self.connection.connect() as con:
|
|
133
|
+
context = MigrationContext.configure(con)
|
|
134
|
+
return context.get_current_revision()
|
|
135
|
+
|
|
136
|
+
def get_model(self, name):
|
|
137
|
+
return getattr(self.base.classes, name)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"git_version": "4623c40", "is_release": true}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
from glob import glob
|
|
3
|
-
from unittest import TestCase
|
|
4
|
-
|
|
5
|
-
from sqlalchemy import MetaData
|
|
6
|
-
|
|
7
|
-
from openmodule.config import settings
|
|
8
|
-
from openmodule.database.database import Database, database_path
|
|
9
|
-
|
|
10
|
-
_first_start = True
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def truncate_all_tables(database: Database, keep=("alembic_version",)):
|
|
14
|
-
assert any(x in database.db_folder for x in ["/test/"]), "deleting all tables is only for testing"
|
|
15
|
-
metadata = MetaData(bind=database._engine)
|
|
16
|
-
metadata.reflect()
|
|
17
|
-
with database._engine.connect() as con:
|
|
18
|
-
trans = con.begin()
|
|
19
|
-
for table in reversed(metadata.sorted_tables):
|
|
20
|
-
if table.name not in keep:
|
|
21
|
-
con.execute(table.delete())
|
|
22
|
-
trans.commit()
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class SQLiteTestMixin(TestCase):
|
|
26
|
-
"""
|
|
27
|
-
Mixin for database cleanup in test cases
|
|
28
|
-
* use create_database = True for an automatic generation of a database
|
|
29
|
-
* use create_database = False and set the database directly
|
|
30
|
-
"""
|
|
31
|
-
create_database = True
|
|
32
|
-
database = None
|
|
33
|
-
database_folder: str = None # defaults to settings.DATABASE_FOLDER
|
|
34
|
-
alembic_path = "../src/database"
|
|
35
|
-
database_name = "database"
|
|
36
|
-
|
|
37
|
-
@classmethod
|
|
38
|
-
def get_database_folder(cls):
|
|
39
|
-
return cls.database_folder or settings.DATABASE_FOLDER
|
|
40
|
-
|
|
41
|
-
@classmethod
|
|
42
|
-
def setUpClass(cls) -> None:
|
|
43
|
-
# we only know which databases are in use on tear down, so truncating only works in teardown
|
|
44
|
-
# but in order to not be annoyed by failed tests which left broken databases, we delete all databases
|
|
45
|
-
# once initially
|
|
46
|
-
global _first_start
|
|
47
|
-
if _first_start:
|
|
48
|
-
for file in glob(os.path.join(cls.get_database_folder(), "*.sqlite3")):
|
|
49
|
-
os.unlink(file)
|
|
50
|
-
_first_start = False
|
|
51
|
-
if cls.create_database:
|
|
52
|
-
cls.database = Database(cls.get_database_folder(), cls.database_name, cls.alembic_path)
|
|
53
|
-
return super().setUpClass()
|
|
54
|
-
|
|
55
|
-
def delete_database(self, database: Database):
|
|
56
|
-
assert not database.is_open(), "database must be shutdown before it can be deleted"
|
|
57
|
-
try:
|
|
58
|
-
os.unlink(database_path(database.db_folder, database.name))
|
|
59
|
-
except FileNotFoundError:
|
|
60
|
-
pass
|
|
61
|
-
|
|
62
|
-
def tearDown(self):
|
|
63
|
-
super().tearDown()
|
|
64
|
-
if self.create_database:
|
|
65
|
-
truncate_all_tables(self.database)
|
|
66
|
-
|
|
67
|
-
@classmethod
|
|
68
|
-
def tearDownClass(cls):
|
|
69
|
-
if cls.create_database:
|
|
70
|
-
cls.database.shutdown()
|
|
71
|
-
super().tearDownClass()
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"git_version": "6327d5e", "is_release": true}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openmodule_test-13.1.4 → openmodule_test-13.3.0}/openmodule_test.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|