Skip to content

test: add tests to have a full coverage#207

Merged
mdevolde merged 7 commits into
jxmorris12:masterfrom
mdevolde:test/full_coverage
Jul 2, 2026
Merged

test: add tests to have a full coverage#207
mdevolde merged 7 commits into
jxmorris12:masterfrom
mdevolde:test/full_coverage

Conversation

@mdevolde

@mdevolde mdevolde commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

test: add tests to have a full coverage

Why the pull request was made

To have a full coverage of the library, and easily detect bugs on future changes.

Summary of changes

  • Refactor tests structure in benchmark, integration, property, unit.
  • Add benchmarks tests.
  • Add pytest-benchmark and hypothesis as test dependencies.
  • Add tests unit, property and bench tests.
  • Refactor existing tests.
  • Remove useless tests.

Screenshots (if appropriate):

Not applicable.

How has this been tested?

Applied tests.

Resources

Not applicable.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (changes to documentation only)
  • Refactor / code style update (non-breaking change that improves code structure or readability)
  • Tests / CI improvement (adding or updating tests or CI configuration only)
  • Chore / maintenance (non-breaking change that does not affect functionality, such as updating dependencies or fixing typos)
  • Other (please describe):

Checklist

  • Followed the project's contributing guidelines.
  • Updated any relevant tests.
  • Updated any relevant documentation.
  • Added comments to your code where necessary.
  • Formatted your code, run the linters, checked types and tests.
  • Added your changes to the CHANGELOG file, if applicable.

@mdevolde mdevolde self-assigned this Jun 27, 2026
@codecov-commenter

codecov-commenter commented Jun 27, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.88%. Comparing base (c13dbb5) to head (644bfc8).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##           master     #207       +/-   ##
===========================================
+ Coverage   80.67%   99.88%   +19.20%     
===========================================
  Files          13       13               
  Lines        1770     1699       -71     
===========================================
+ Hits         1428     1697      +269     
+ Misses        342        2      -340     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mdevolde mdevolde force-pushed the test/full_coverage branch from b27716e to d7812b1 Compare June 27, 2026 17:26
Comment thread tests/unit/test_internals_utils.py Fixed
Comment thread tests/unit/test_download_unit.py Fixed
@mdevolde mdevolde force-pushed the test/full_coverage branch from d7812b1 to 42c9c4e Compare June 27, 2026 17:33
Comment thread tests/unit/test_server_unit.py Dismissed
Comment thread tests/unit/test_download_unit.py Fixed
@mdevolde mdevolde force-pushed the test/full_coverage branch 3 times, most recently from e343190 to c782627 Compare July 1, 2026 11:59
Comment thread tests/unit/test_server_unit.py Fixed
@mdevolde mdevolde force-pushed the test/full_coverage branch from 6dfd2fb to 9991d62 Compare July 1, 2026 15:05
@mdevolde mdevolde force-pushed the test/full_coverage branch from 9991d62 to 2c5fe23 Compare July 1, 2026 17:19
@mdevolde mdevolde force-pushed the test/full_coverage branch from 3b00113 to ead694b Compare July 1, 2026 21:01
Comment thread tests/property/test_prop_language_tag.py Dismissed
Comment thread tests/integration/test_api_public.py Dismissed
@mdevolde mdevolde requested a review from Copilot July 2, 2026 11:25
@mdevolde mdevolde marked this pull request as ready for review July 2, 2026 11:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restructures and significantly expands the test suite to drive higher coverage and make regressions easier to catch, while also adding new testing/benchmarking dependencies and a few small coverage-annotation changes in the library code.

Changes:

  • Reorganized tests into unit/, integration/, property/, and benchmarks/ suites with collection markers.
  • Added extensive new unit + property-based coverage for core modules (server, download, safe_zip, config, match, language tag, CLI).
  • Added test tooling/dependencies (hypothesis, pytest-benchmark) and minor CI/dev-experience tweaks (markers, --basetemp, clean target).

Reviewed changes

Copilot reviewed 45 out of 47 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
uv.lock Locks new test dependencies (hypothesis, pytest-benchmark) and their transitive deps.
pyproject.toml Adds new test deps; expands Ruff per-file ignores; adds mypy override for Hypothesis-heavy tests.
pytest.ini Adds markers and sets project-local --basetemp for tmp dirs.
.github/workflows/test.yml CI matrix tweak (Python 3.15 beta version bump); continues running pytest in CI.
Makefile Adds clean target; makes publish run clean first; updates usage output.
make.bat Adds clean target and wires publish through it; updates usage output.
.gitignore Ignores .pytest_tmp/ (the new --basetemp directory).
src/language_tool_python/server.py Adds coverage annotation for an effectively-unreachable branch in response decoding.
src/language_tool_python/language_tag.py Enhances docstring parameter documentation.
src/language_tool_python/download_lt.py Adds pragma: no cover to abstract/unreachable paths; annotates some TOCTOU-only branches.
src/language_tool_python/config_file.py Adds pragma: no cover and explanation for hard-to-create path types.
src/language_tool_python/_internals/safe_zip.py Annotates TOCTOU/defensive branches and refines coverage pragmas.
src/language_tool_python/_internals/compat.py Marks version-specific fallback imports as not coverable in the coverage environment.
src/language_tool_python/main.py Adds defensive coverage pragmas and annotates main guard.
tests/unit/init.py Declares unit test package.
tests/unit/conftest.py Automatically applies the unit marker to tests under tests/unit/.
tests/unit/test_api_types.py Adds unit tests for API response type-guard helpers.
tests/unit/test_cli_args.py Adds focused unit tests for CLI argument parsing edge cases.
tests/unit/test_cli_unit.py Adds unit tests for CLI helpers (get_text, stdin handling, main status aggregation, etc.).
tests/unit/test_config_unit.py Adds unit tests for config encoding/validation and LanguageToolConfig behavior.
tests/unit/test_config_validation.py Adds targeted unit tests for injection/backslash protections in config serialization.
tests/unit/test_download.py Refactors download tests to avoid module reloads; adds more HTTP error-path tests.
tests/unit/test_download_unit.py Adds unit-level tests for download_lt.py helpers and version logic without network/Java.
tests/unit/test_internals_utils.py Adds unit tests for internal helpers like env parsing, locale fallback, psutil killing, version parsing.
tests/unit/test_language_tag.py Adds unit tests for LanguageTag normalization, fallback behavior, and comparisons.
tests/unit/test_match.py Adds unit tests for Match construction, formatting, comparison, iteration, and helper functions.
tests/unit/test_safe_zip.py Refactors to tmp_path; adds more fine-grained safe-zip unit tests (incl. internal helpers).
tests/unit/test_server_unit.py Adds extensive isolated unit tests for server logic (no Java/network required).
tests/unit/test_utils.py Adds unit tests for classify_matches, correct, and TextStatus enum values.
tests/test_api_public.py (deleted) Removes old public-API test; superseded by tests/integration/test_api_public.py.
tests/property/init.py Declares property test package.
tests/property/conftest.py Automatically applies the property marker to tests under tests/property/.
tests/property/test_prop_config.py Adds Hypothesis tests for config invariants and schema behaviors.
tests/property/test_prop_language_tag.py Adds Hypothesis tests for LanguageTag normalization/ordering invariants.
tests/property/test_prop_safe_zip.py Adds Hypothesis adversarial tests for path traversal protections in safe zip handling.
tests/property/test_prop_utils.py Adds Hypothesis tests for utility-function invariants (correct, classify_matches).
tests/integration/init.py Declares integration test package.
tests/integration/conftest.py Automatically applies the integration marker to tests under tests/integration/.
tests/integration/test_api_public.py Adds more stable public API integration assertions (field-level vs full snapshot).
tests/integration/test_cli.py Refactors CLI integration tests and helpers; uses public properties for host/port.
tests/integration/test_config.py Improves caching timing test robustness; moves invalid-language test into integration.
tests/integration/test_download.py Adds integration tests for real network download/version behaviors.
tests/integration/test_match.py Updates integration match expectations to be less brittle re: typography.
tests/integration/test_server_local.py Improves cleanup reliability and uses public accessors (host, port).
tests/benchmarks/init.py Declares benchmarks package.
tests/benchmarks/conftest.py Automatically applies the perf marker to tests under tests/benchmarks/.
tests/benchmarks/test_bench_check.py Adds benchmark tests using pytest-benchmark for check/correct performance.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/benchmarks/test_bench_check.py
@mdevolde mdevolde force-pushed the test/full_coverage branch from 0a0edfc to c2bcc80 Compare July 2, 2026 11:54
@mdevolde mdevolde force-pushed the test/full_coverage branch from c2bcc80 to 644bfc8 Compare July 2, 2026 11:56
@mdevolde mdevolde merged commit be97cfc into jxmorris12:master Jul 2, 2026
13 checks passed
@mdevolde mdevolde deleted the test/full_coverage branch July 2, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants