Skip to content

Speakr is a personal, self-hosted web application designed for transcribing audio recordings

Python

Tests: make 8 files' run/run_test harness re-raise under pytest (they were swallowing failures)

Murtaza Nasir31f55dcdd108
diff --git a/tests/test_admin_hotwords_and_bugfixes.py b/tests/test_admin_hotwords_and_bugfixes.py
index 05a47c93..1b2fffce 100644
--- a/tests/test_admin_hotwords_and_bugfixes.py
+++ b/tests/test_admin_hotwords_and_bugfixes.py
@@ -36,10 +36,14 @@ def run_test(name, func):
print(f" ✗ {name}: {e}")
FAILED += 1
ERRORS.append((name, str(e)))
+ if "pytest" in sys.modules:
+ raise
except Exception as e:
print(f" ✗ {name}: EXCEPTION - {e}")
FAILED += 1
ERRORS.append((name, f"Exception: {e}"))
+ if "pytest" in sys.modules:
+ raise
# =============================================================================
diff --git a/tests/test_api_v1_parity.py b/tests/test_api_v1_parity.py
index 47edb251..5b8049e8 100644
--- a/tests/test_api_v1_parity.py
+++ b/tests/test_api_v1_parity.py
@@ -32,9 +32,13 @@ def run(name, func):
except AssertionError as e:
print(f" ✗ {name}: {e}")
FAILED += 1
+ if "pytest" in sys.modules:
+ raise
except Exception as e:
print(f" ✗ {name}: EXCEPTION - {e}")
FAILED += 1
+ if "pytest" in sys.modules:
+ raise
def setup_user_and_recording():
diff --git a/tests/test_connector_architecture.py b/tests/test_connector_architecture.py
index af858baf..e12f6c49 100644
--- a/tests/test_connector_architecture.py
+++ b/tests/test_connector_architecture.py
@@ -39,10 +39,14 @@ def run_test(name, func):
print(f" ✗ {name}: {e}")
FAILED += 1
ERRORS.append((name, str(e)))
+ if "pytest" in sys.modules:
+ raise
except Exception as e:
print(f" ✗ {name}: EXCEPTION - {e}")
FAILED += 1
ERRORS.append((name, f"Exception: {e}"))
+ if "pytest" in sys.modules:
+ raise
def clear_env():
diff --git a/tests/test_embedding_api_mode.py b/tests/test_embedding_api_mode.py
index 97fcd929..253c5ecf 100644
--- a/tests/test_embedding_api_mode.py
+++ b/tests/test_embedding_api_mode.py
@@ -35,9 +35,13 @@ def run(name, func):
except AssertionError as e:
print(f" ✗ {name}: {e}")
FAILED += 1
+ if "pytest" in sys.modules:
+ raise
except Exception as e:
print(f" ✗ {name}: EXCEPTION - {e}")
FAILED += 1
+ if "pytest" in sys.modules:
+ raise
def reload_with_env(**env):
diff --git a/tests/test_embedding_identifier_compat.py b/tests/test_embedding_identifier_compat.py
index df92e6b1..b5cce4bf 100644
--- a/tests/test_embedding_identifier_compat.py
+++ b/tests/test_embedding_identifier_compat.py
@@ -39,9 +39,13 @@ def run(name, func):
except AssertionError as e:
print(f" FAIL {name}: {e}")
FAILED += 1
+ if "pytest" in sys.modules:
+ raise
except Exception as e:
print(f" FAIL {name}: EXCEPTION - {e}")
FAILED += 1
+ if "pytest" in sys.modules:
+ raise
def reset_settings(stored_identifier=None, legacy_model_name=None):
diff --git a/tests/test_reprocess_hotwords.py b/tests/test_reprocess_hotwords.py
index 93561f42..6260bf81 100644
--- a/tests/test_reprocess_hotwords.py
+++ b/tests/test_reprocess_hotwords.py
@@ -42,9 +42,13 @@ def run(name, func):
except AssertionError as e:
print(f" ✗ {name}: {e}")
FAILED += 1
+ if "pytest" in sys.modules:
+ raise
except Exception as e:
print(f" ✗ {name}: EXCEPTION - {e}")
FAILED += 1
+ if "pytest" in sys.modules:
+ raise
def setup_recording(*, owner_hotwords=None, owner_prompt=None,
diff --git a/tests/test_title_truncation.py b/tests/test_title_truncation.py
index d585324a..d79a7a62 100644
--- a/tests/test_title_truncation.py
+++ b/tests/test_title_truncation.py
@@ -39,9 +39,13 @@ def run(name, func):
except AssertionError as e:
print(f" ✗ {name}: {e}")
FAILED += 1
+ if "pytest" in sys.modules:
+ raise
except Exception as e:
print(f" ✗ {name}: EXCEPTION - {e}")
FAILED += 1
+ if "pytest" in sys.modules:
+ raise
def make_cyrillic_transcript():
diff --git a/tests/test_transcription_model_override.py b/tests/test_transcription_model_override.py
index 3a9a2bd3..5dd145e0 100644
--- a/tests/test_transcription_model_override.py
+++ b/tests/test_transcription_model_override.py
@@ -50,9 +50,13 @@ def run(name, func):
except AssertionError as e:
print(f" ✗ {name}: {e}")
FAILED += 1
+ if "pytest" in sys.modules:
+ raise
except Exception as e:
print(f" ✗ {name}: EXCEPTION - {e}")
FAILED += 1
+ if "pytest" in sys.modules:
+ raise
# -----------------------------------------------------------------------------