Skip to content

Commit

Permalink
Merge branch 'develop' into fix-alembic-sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
IanMayo authored Sep 27, 2021
2 parents 3210e1b + 3456dac commit c05a0d9
Show file tree
Hide file tree
Showing 16 changed files with 47 additions and 70 deletions.
5 changes: 2 additions & 3 deletions tests/test_admin_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,8 +807,7 @@ def setUp(self):
port=55527,
)
except RuntimeError:
print("PostgreSQL database couldn't be created! Test is skipping.")
return
raise Exception("Testing Postgres server could not be started/accessed")
try:
self.store = DataStore(
db_name="test",
Expand All @@ -820,7 +819,7 @@ def setUp(self):
)
self.store.initialise()
except OperationalError:
print("Database schema and data population failed! Test is skipping.")
raise Exception("Creating database schema in testing Postgres database failed")

def tearDown(self):
try:
Expand Down
3 changes: 1 addition & 2 deletions tests/test_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,7 @@ def setUp(self):
port=55527,
)
except RuntimeError:
print("PostgreSQL database couldn't be created! Test is skipping.")
return
raise Exception("Testing Postgres server could not be started/accessed")

self.store = DataStore(
db_name="test",
Expand Down
35 changes: 14 additions & 21 deletions tests/test_data_store_api_postgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ def setUp(self) -> None:
port=55527,
)
except RuntimeError:
print("PostgreSQL database couldn't be created! Test is skipping.")
return
raise Exception("Testing Postgres server could not be started/accessed")
try:
self.store = DataStore(
db_name="test",
Expand All @@ -53,8 +52,8 @@ def setUp(self) -> None:
self.change_id = self.store.add_to_changes(
"TEST", datetime.utcnow(), "TEST"
).change_id
except OperationalError:
print("Database schema and data population failed! Test is skipping.")
except Exception:
raise Exception("Testing postgres server could not be started/accessed")

def tearDown(self) -> None:
try:
Expand Down Expand Up @@ -258,8 +257,7 @@ def setUp(self) -> None:
port=55527,
)
except RuntimeError:
print("PostgreSQL database couldn't be created! Test is skipping.")
return
raise Exception("Testing Postgres server could not be started/accessed")
try:
self.store = DataStore(
db_name="test",
Expand All @@ -275,7 +273,7 @@ def setUp(self) -> None:
"TEST", datetime.utcnow(), "TEST"
).change_id
except OperationalError:
print("Database schema and data population failed! Test is skipping.")
raise Exception("Creating database schema in testing Postgres database failed")

def tearDown(self) -> None:
try:
Expand Down Expand Up @@ -406,8 +404,7 @@ def setUp(self) -> None:
port=55527,
)
except RuntimeError:
print("PostgreSQL database couldn't be created! Test is skipping.")
return
raise Exception("Testing Postgres server could not be started/accessed")
try:
self.store = DataStore(
db_name="test",
Expand All @@ -430,7 +427,7 @@ def setUp(self) -> None:
).name
self.privacy = self.store.add_to_privacies("test_privacy", 0, self.change_id).name
except OperationalError:
print("Database schema and data population failed! Test is skipping.")
raise Exception("Creating database schema in testing Postgres database failed")

def tearDown(self) -> None:
try:
Expand Down Expand Up @@ -637,8 +634,7 @@ def setUp(self) -> None:
port=55527,
)
except RuntimeError:
print("PostgreSQL database couldn't be created! Test is skipping.")
return
raise Exception("Testing Postgres server could not be started/accessed")
try:
self.store = DataStore(
db_name="test",
Expand All @@ -653,7 +649,7 @@ def setUp(self) -> None:
self.store.populate_reference(TEST_DATA_PATH)
self.store.populate_metadata(TEST_DATA_PATH)
except OperationalError:
print("Database schema and data population failed! Test is skipping.")
raise Exception("Creating database schema in testing Postgres database failed")

def tearDown(self) -> None:
try:
Expand Down Expand Up @@ -718,8 +714,7 @@ def setUp(self) -> None:
port=55527,
)
except RuntimeError:
print("PostgreSQL database couldn't be created! Test is skipping.")
return
raise Exception("Testing Postgres server could not be started/accessed")
try:
self.store = DataStore(
db_name="test",
Expand Down Expand Up @@ -754,7 +749,7 @@ def setUp(self) -> None:
)
self.store.session.expunge(self.platform)
except OperationalError:
print("Database schema and data population failed! Test is skipping.")
raise Exception("Creating database schema in testing Postgres database failed")

def tearDown(self) -> None:
try:
Expand Down Expand Up @@ -831,8 +826,7 @@ def setUp(self) -> None:
port=55527,
)
except RuntimeError:
print("PostgreSQL database couldn't be created! Test is skipping.")
return
raise Exception("Testing Postgres server could not be started/accessed")
try:
self.store = DataStore(
db_name="test",
Expand Down Expand Up @@ -879,7 +873,7 @@ def setUp(self) -> None:
self.store.session.expunge(self.file)
self.store.session.expunge(self.comment_type)
except OperationalError:
print("Database schema and data population failed! Test is skipping.")
raise Exception("Creating database schema in testing Postgres database failed")

class TestParser(Importer):
def __init__(
Expand Down Expand Up @@ -1018,8 +1012,7 @@ def setUp(self) -> None:
port=55527,
)
except RuntimeError:
print("PostgreSQL database couldn't be created! Test is skipping.")
return
raise Exception("Testing Postgres server could not be started/accessed")

def tearDown(self) -> None:
try:
Expand Down
5 changes: 3 additions & 2 deletions tests/test_data_store_clear_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from pepys_import.core.store.data_store import DataStore


@pytest.mark.postgres
class DataStoreClearContentsPostGISDBTestCase(TestCase):
def setUp(self):
self.store = None
Expand All @@ -20,7 +21,7 @@ def setUp(self):
port=55527,
)
except RuntimeError:
print("PostgreSQL database couldn't be created! Test is skipping.")
raise Exception("Creating database schema in testing Postgres database failed")

def tearDown(self):
try:
Expand Down Expand Up @@ -108,7 +109,7 @@ def setUp(self):
port=55527,
)
except RuntimeError:
print("PostgreSQL database couldn't be created! Test is skipping.")
raise Exception("Creating database schema in testing Postgres database failed")

def tearDown(self):
try:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_data_store_export_datafile.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def setUp(self):
port=55527,
)
except RuntimeError:
print("PostgreSQL database couldn't be created! Test is skipping.")
raise Exception("Creating database schema in testing Postgres database failed")

def tearDown(self) -> None:
if os.path.exists(self.path):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_data_store_initialise.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def setUp(self):
port=55527,
)
except RuntimeError:
print("PostgreSQL database couldn't be created! Test is skipping.")
raise Exception("Creating database schema in testing Postgres database failed")

def tearDown(self):
try:
Expand Down
5 changes: 2 additions & 3 deletions tests/test_data_store_populate.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ def setUp(self) -> None:
port=55527,
)
except RuntimeError:
print("PostgreSQL database couldn't be created! Test is skipping.")
return
raise Exception("Testing Postgres server could not be started/accessed")
try:
self.store = DataStore(
db_name="test",
Expand All @@ -169,7 +168,7 @@ def setUp(self) -> None:
)
self.store.initialise()
except OperationalError:
print("Database schema and data population failed! Test is skipping.")
raise Exception("Creating database schema in testing Postgres database failed")

def tearDown(self) -> None:
try:
Expand Down
10 changes: 4 additions & 6 deletions tests/test_datastore_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,7 @@ def setUp(self):
port=55527,
)
except RuntimeError:
print("PostgreSQL database couldn't be created! Test is skipping.")
return
raise Exception("Testing Postgres server could not be started/accessed")
try:
self.store = DataStore(
db_name="test",
Expand All @@ -262,7 +261,7 @@ def setUp(self):
)
self.store.initialise()
except Exception:
print("Database schema and data population failed! Test is skipping.")
raise Exception("Creating database schema in testing Postgres database failed")

def tearDown(self):
try:
Expand Down Expand Up @@ -354,8 +353,7 @@ def setUp(self):
port=55527,
)
except RuntimeError:
print("PostgreSQL database couldn't be created! Test is skipping.")
return
raise Exception("Testing Postgres server could not be started/accessed")
try:
self.store = DataStore(
db_name="test",
Expand All @@ -367,7 +365,7 @@ def setUp(self):
)
self.store.initialise()
except Exception:
print("Database schema and data population failed! Test is skipping.")
raise Exception("Creating database schema in testing Postgres database failed")

def tearDown(self):
try:
Expand Down
15 changes: 6 additions & 9 deletions tests/test_import_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ def setUp(self):
port=55527,
)
except RuntimeError:
print("PostgreSQL database couldn't be created! Test is skipping.")
return
raise Exception("Testing Postgres server could not be started/accessed")
try:
self.store = DataStore(
db_name="test",
Expand All @@ -93,7 +92,7 @@ def setUp(self):
)
self.store.initialise()
except OperationalError:
print("Database schema and data population failed! Test is skipping.")
raise Exception("Creating database schema in testing Postgres database failed")

def tearDown(self):
try:
Expand Down Expand Up @@ -142,8 +141,7 @@ def setUp(self):
port=55527,
)
except RuntimeError:
print("PostgreSQL database couldn't be created! Test is skipping.")
return
raise Exception("Testing Postgres server could not be started/accessed")
try:
self.store = DataStore(
db_name="test",
Expand All @@ -155,7 +153,7 @@ def setUp(self):
)
self.store.initialise()
except OperationalError:
print("Database schema and data population failed! Test is skipping.")
raise Exception("Creating database schema in testing Postgres database failed")

def tearDown(self):
try:
Expand Down Expand Up @@ -424,8 +422,7 @@ def setUp(self):
port=55527,
)
except RuntimeError:
print("PostgreSQL database couldn't be created! Test is skipping.")
return
raise Exception("Testing Postgres server could not be started/accessed")
try:
self.store = DataStore(
db_name="test",
Expand All @@ -437,7 +434,7 @@ def setUp(self):
)
self.store.initialise()
except OperationalError:
print("Database schema and data population failed! Test is skipping.")
raise Exception("Creating database schema in testing Postgres database failed")

def tearDown(self):
try:
Expand Down
5 changes: 2 additions & 3 deletions tests/test_import_cli_end_to_end.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,7 @@ def setup_method(self, test_method):
port=55527,
)
except RuntimeError:
print("PostgreSQL database couldn't be created! Test is skipping.")
return
raise Exception("Testing Postgres server could not be started/accessed")
try:
self.store = DataStore(
db_name="test",
Expand All @@ -250,7 +249,7 @@ def setup_method(self, test_method):
)
self.store.initialise()
except OperationalError:
print("Database schema and data population failed! Test is skipping.")
raise Exception("Creating database schema in testing Postgres database failed")
with self.store.session_scope():
self.store.populate_reference()

Expand Down
5 changes: 2 additions & 3 deletions tests/test_importers_postgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ def setUp(self) -> None:
port=55527,
)
except RuntimeError:
print("PostgreSQL database couldn't be created! Test is skipping.")
return
raise Exception("Testing Postgres server could not be started/accessed")
try:
self.store = DataStore(
db_name="test",
Expand All @@ -43,7 +42,7 @@ def setUp(self) -> None:
)
self.store.initialise()
except OperationalError:
print("Database schema and data population failed! Test is skipping.")
raise Exception("Creating database schema in testing Postgres database failed")

def tearDown(self) -> None:
try:
Expand Down
6 changes: 2 additions & 4 deletions tests/test_merging.py
Original file line number Diff line number Diff line change
Expand Up @@ -1106,8 +1106,7 @@ def setUp(self):
port=55527,
)
except RuntimeError:
print("PostgreSQL database couldn't be created! Test is skipping.")
return
raise Exception("Testing Postgres server could not be started/accessed")

self.master_store = DataStore(
db_name="test",
Expand Down Expand Up @@ -2377,8 +2376,7 @@ def setUp(self, patched_input, patched_iterfzf):
port=55527,
)
except RuntimeError:
print("PostgreSQL database couldn't be created! Test is skipping.")
return
raise Exception("Testing Postgres server could not be started/accessed")

self.master_store = DataStore(
db_name="test",
Expand Down
5 changes: 2 additions & 3 deletions tests/test_spatial_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ def setUp(self):
port=55527,
)
except RuntimeError:
print("PostgreSQL database couldn't be created! Test is skipping.")
return
raise Exception("Testing Postgres server could not be started/accessed")
try:
self.store = DataStore(
db_name="test",
Expand Down Expand Up @@ -131,7 +130,7 @@ def setUp(self):
state.location = loc
self.store.session.add(state)
except OperationalError:
print("Database schema and data population failed! Test is skipping.")
raise Exception("Creating database schema in testing Postgres database failed")

def tearDown(self):
try:
Expand Down
3 changes: 1 addition & 2 deletions tests/test_tasks_and_participants.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,7 @@ def setUp(self):
port=55527,
)
except RuntimeError:
print("PostgreSQL database couldn't be created! Test is skipping.")
return
raise Exception("Testing Postgres server could not be started/accessed")

self.store = DataStore(
db_name="test",
Expand Down
Loading

0 comments on commit c05a0d9

Please sign in to comment.