Spaces:
Running
on
Zero
Running
on
Zero
A newer version of the Gradio SDK is available:
6.1.0
Test Suite for LLM Topic Modeller
This test suite provides comprehensive testing for the CLI interface (cli_topics.py) and GUI application (app.py).
Overview
The test suite includes:
- CLI Tests: Tests based on examples from the
cli_topics.pyepilog - GUI Tests: Tests to verify the Gradio interface loads correctly
- Mock Inference Server: A dummy inference-server endpoint that avoids API costs during testing
Structure
test.py: Main test suite with CLI teststest_gui_only.py: GUI-specific testsmock_inference_server.py: Mock HTTP server that mimics an inference-server APIrun_tests.py: Test runner script__init__.py: Package initialization
Running Tests
Run All Tests
From the project root directory:
python test/run_tests.py
Or from the test directory:
python run_tests.py
Run Only CLI Tests
python -m unittest test.test.TestCLITopicsExamples
Run Only GUI Tests
python test/test_gui_only.py
Mock Inference Server
The test suite uses a mock inference server to avoid API costs during testing. The mock server:
- Listens on
localhost:8080by default - Responds to
/v1/chat/completionsendpoint - Returns valid markdown table responses that satisfy validation requirements
- Provides token counts for usage tracking
The mock server is automatically started before tests and stopped after tests complete.
Test Coverage
The CLI tests cover:
Topic Extraction
- Default settings
- Custom model and context
- Grouping by column
- Zero-shot extraction with candidate topics
Topic Deduplication
- Fuzzy matching
- LLM-based deduplication
All-in-One Pipeline
- Complete workflow (extract, deduplicate, summarise)
Requirements
- Python 3.7+
- All dependencies from
requirements.txt - Example data files in
example_data/directory
Notes
- Tests will be skipped if required example files are not found
- The mock server must be running for CLI tests to work
- Tests use temporary output directories that are cleaned up after execution