Optimize corpus tests: mock downloads, separate data validation, suppress CLI output#1291
Merged
Optimize corpus tests: mock downloads, separate data validation, suppress CLI output#1291
Conversation
Co-authored-by: bact <128572+bact@users.noreply.github.com>
Co-authored-by: bact <128572+bact@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Improve speed and stability of corpus test cases
Mock corpus downloads in core tests for speed and stability
Feb 6, 2026
Co-authored-by: bact <128572+bact@users.noreply.github.com>
Co-authored-by: bact <128572+bact@users.noreply.github.com>
Co-authored-by: bact <128572+bact@users.noreply.github.com>
Copilot
AI
changed the title
Mock corpus downloads in core tests for speed and stability
Add dedicated corpus integrity testing workflow
Feb 6, 2026
…rence Co-authored-by: bact <128572+bact@users.noreply.github.com>
Co-authored-by: bact <128572+bact@users.noreply.github.com>
Copilot
AI
changed the title
Add dedicated corpus integrity testing workflow
Optimize corpus tests with mocking and add dedicated integrity workflow
Feb 6, 2026
…oads Co-authored-by: bact <128572+bact@users.noreply.github.com>
Copilot
AI
changed the title
Optimize corpus tests with mocking and add dedicated integrity workflow
Suppress CLI test output and mock corpus downloads
Feb 6, 2026
bact
reviewed
Feb 6, 2026
bact
reviewed
Feb 6, 2026
Co-authored-by: bact <128572+bact@users.noreply.github.com>
Member
|
@copilot apply suggestions about documentation and tests in |
Co-authored-by: bact <128572+bact@users.noreply.github.com>
bact
reviewed
Feb 6, 2026
Co-authored-by: bact <128572+bact@users.noreply.github.com>
Co-authored-by: bact <128572+bact@users.noreply.github.com>
Copilot
AI
changed the title
Optimize corpus tests: mock downloads, add catalog tests, suppress CLI output
Optimize corpus tests: mock downloads, separate data validation, suppress CLI output
Feb 6, 2026
bact
approved these changes
Feb 6, 2026
Reworded the description of the corpus test suite for clarity and readability.
Add SPDX license and copyright information to README
Add SPDX license and copyright information to README
Fix formatting of the 'Run corpus test' section in README.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What do these changes do
Separates corpus testing concerns: fast mocked unit tests vs comprehensive data validation. Eliminates network dependencies and output pollution from regular test runs.
What was wrong
Unit tests: Downloaded large corpus files (96MB OSCAR, 186MB TNC) on every run, taking 21s and requiring network access. Caused slow development cycles and flaky tests.
CLI tests: Printed verbose catalog listings and corpus metadata to logs, obscuring test failures. Made network requests during testing.
Missing coverage: No tests for corpus catalog operations (
get_corpus_db,corpus_db_url, catalog structure validation).How this fixes it
1. Mock corpus downloads in unit tests (
tests/core/test_corpus.py)Result: 21s → 2s (90% faster), no network dependency
2. Separate corpus data workflow (
.github/workflows/corpus.yml)pythainlp/corpus/**ortests/corpus/**changes3. Corpus catalog tests (
tests/corpus/test_catalog.py)4. Suppress CLI output (
tests/core/test_cli.py,tests/extra/testx_cli.py)Result: Clean logs, 200x faster data CLI tests
5. Simplified naming
tests/corpus/tests.corpusTest coverage maintained: all parsing logic validated via representative mock data.
Your checklist for this pull request
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.