romybeaute commited on
Commit
bc76dc7
·
1 Parent(s): c810e2f

added tests help

Browse files
Files changed (1) hide show
  1. tests/tests.md +24 -18
tests/tests.md CHANGED
@@ -1,26 +1,32 @@
1
- # How to run the tests
2
 
3
- #### Install pytest if not already installed
4
- pip install pytest
5
-
6
- #### Run all tests
7
- pytest tests/ -v
8
-
9
- #### Run specific test file (eg test_core_functions.py)
10
- pytest tests/test_core_functions.py -v
11
 
 
12
 
13
- # Which tests to run:
 
14
 
15
- ### Test utility functions (fast)
16
- pytest tests/test_core_functions.py -v
17
-
18
- ### Integration tests (slow, run occasionally):
 
19
 
20
- - Without LLM tests
21
- pytest tests/test_integration.py -v
 
 
 
22
 
23
- - With LLM tests (needs token)
24
- HF_TOKEN=your_token pytest tests/test_integration.py -v
25
 
 
 
 
 
26
 
 
 
 
 
 
1
+ # MOSAICapp Test Suite
2
 
3
+ This directory contains the automated tests for the MOSAICapp software.
 
 
 
 
 
 
 
4
 
5
+ ## File Structure
6
 
7
+ ### 1. `conftest.py`
8
+ Contains **fixtures** (setup code) shared across all tests. It generates temporary CSV files and dummy datasets so tests can run without external data dependencies.
9
 
10
+ ### 2. `test_core_functions.py` (Fast)
11
+ Unit tests for the `mosaic_core` utility functions. These run instantly.
12
+ - **Slugify:** Checks filename sanitisation.
13
+ - **CacheIO:** Verifies that topic labels can be saved/loaded from JSON.
14
+ - **Device Resolution:** Ensures the app correctly selects CPU/GPU/MPS devices.
15
 
16
+ ### 3. `test_integration.py` (Slow)
17
+ Integration tests that run the actual ML pipeline.
18
+ - **Embeddings:** Loads the `sentence-transformers` model and checks vector output.
19
+ - **Topic Modelling:** Runs a minimal BERTopic pipeline (UMAP + HDBSCAN) on dummy data.
20
+ - **LLM labeling:** (Optional) Tests the HuggingFace API connection if `HF_TOKEN` is present in the environment.
21
 
22
+ ## How to Run
 
23
 
24
+ **Run everything:**
25
+ ```bash
26
+ pytest tests/ -v
27
+ ```
28
 
29
+ **Run only fast tests:**
30
+ ```bash
31
+ pytest tests/test_core_functions.py -v
32
+ ```