testing
plantdb.commons.testing Link
This module provides a set of classes useful for testing procedures.
DummyDBTestCase Link
Bases: TestCase
A dummy test database.
Attributes:
Name | Type | Description |
---|---|---|
db |
FSDB
|
The temporary directory. |
tmpclone |
TemporaryCloneDB
|
A local temporary copy of a dummy test database. |
get_test_db Link
get_test_db(db_path=None)
Return the test FSDB
database.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
db_path
|
str
|
If |
None
|
Returns:
Type | Description |
---|---|
FSDB
|
The database to test. |
Source code in plantdb/commons/testing.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
|
get_test_fileset Link
get_test_fileset()
Return the default test Fileset
object named 'fileset_001'.
Returns:
Type | Description |
---|---|
Scan
|
The default fileset instance to test. |
Source code in plantdb/commons/testing.py
122 123 124 125 126 127 128 129 130 131 132 |
|
get_test_image_file Link
get_test_image_file()
Return the default test File
object named 'test_image'.
Returns:
Type | Description |
---|---|
File
|
The default image file instance to test. |
Source code in plantdb/commons/testing.py
134 135 136 137 138 139 140 141 142 143 144 |
|
get_test_scan Link
get_test_scan()
Return the default test Scan
object named 'myscan_001'.
Returns:
Type | Description |
---|---|
Scan
|
The default scan instance to test. |
Source code in plantdb/commons/testing.py
110 111 112 113 114 115 116 117 118 119 120 |
|
setUp Link
setUp()
Set up a dummy database with fake scan, fileset & files.
Source code in plantdb/commons/testing.py
76 77 78 79 |
|
tearDown Link
tearDown()
Clean up after test.
Source code in plantdb/commons/testing.py
81 82 83 84 85 86 87 88 |
|
FSDBTestCase Link
Bases: TestCase
A local FSDB test database.
Attributes:
Name | Type | Description |
---|---|---|
db |
FSDB
|
The temporary test database with the 'real_plant_analyzed' dataset. |
get_task_fileset Link
get_task_fileset(task_name)
Return the fileset for the corresponding task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_name
|
str
|
The name of the task to get the fileset for. |
required |
Returns:
Type | Description |
---|---|
Fileset
|
The |
Source code in plantdb/commons/testing.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
|
get_task_fileset_id Link
get_task_fileset_id(task_name)
Return the fileset id for the corresponding task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_name
|
str
|
The name of the task to get the fileset for. |
required |
Returns:
Type | Description |
---|---|
str
|
The |
Source code in plantdb/commons/testing.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
|
get_test_db Link
get_test_db()
Return the test FSDB
database.
Source code in plantdb/commons/testing.py
169 170 171 172 |
|
get_test_fileset Link
get_test_fileset(fs_id, create=False)
Return the default test Fileset
object named 'fileset_001'.
Returns:
Type | Description |
---|---|
Scan
|
The default fileset instance to test. |
Source code in plantdb/commons/testing.py
186 187 188 189 190 191 192 193 194 195 196 |
|
get_test_scan Link
get_test_scan()
Return the default test Scan
object named 'real_plant_analyzed'.
Returns:
Type | Description |
---|---|
Scan
|
The default |
Source code in plantdb/commons/testing.py
174 175 176 177 178 179 180 181 182 183 184 |
|
setUp Link
setUp()
Set up a test database with the 'real_plant_analyzed' dataset.
Source code in plantdb/commons/testing.py
156 157 158 |
|
tearDown Link
tearDown()
Clean up after test.
Source code in plantdb/commons/testing.py
160 161 162 163 164 165 166 167 |
|
TemporaryCloneDB Link
TemporaryCloneDB(db_location)
Bases: object
Class for doing tests on a copy of a local DB.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
db_location
|
str
|
Location of the source database to clone in the temporary folder. |
required |
Attributes:
Name | Type | Description |
---|---|---|
tmpdir |
TemporaryDirectory
|
The temporary directory. |
Source code in plantdb/commons/testing.py
54 55 56 |
|