Add comprehensive unit tests and modernize CI to uv + Python 3.11–3.13#3
Merged
Add comprehensive unit tests and modernize CI to uv + Python 3.11–3.13#3
Conversation
- Add tests for versifier/config.py (Config class) - Add tests for versifier/poetry.py (RequirementsFile and Poetry classes) - Add tests for versifier/compiler.py (Nuitka3, Cython, SmartCompiler classes) - Add tests for versifier/core.py (DependencyManager, DependencyExporter, PackageExtractor, PackageObfuscator) - Add tests for versifier/__main__.py (Context class and CLI commands) - Add tests for versifier/stub.py (PackageStubGenerator class) Coverage increased from 25% to 98% Co-Authored-By: 刘奕聪 <github@m.mrlyc.com>
… Poetry version Co-Authored-By: 刘奕聪 <github@m.mrlyc.com>
…test Co-Authored-By: 刘奕聪 <github@m.mrlyc.com>
Co-Authored-By: 刘奕聪 <github@m.mrlyc.com>
Co-Authored-By: 刘奕聪 <github@m.mrlyc.com>
Co-Authored-By: 刘奕聪 <github@m.mrlyc.com>
Co-Authored-By: 刘奕聪 <github@m.mrlyc.com>
4 tasks
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.
Add comprehensive unit tests and modernize CI to uv + Python 3.11–3.13
Summary
This PR adds unit tests for all modules in the versifier project, increasing code coverage from 25% to 98%. The tests cover:
[tool.versifier]and[versifier]sectionsTests use mocking extensively to avoid actual subprocess calls to external tools (poetry, nuitka, cython).
CI Workflow Modernization
astral-sh/setup-uv@v7)ubuntu-20.04(deprecated) →ubuntu-latest['3.6.15', '3.8.18', '3.11.9']→['3.11', '3.12', '3.13']Makefileto useuv sync,uv run, anduv buildin place of Poetry equivalents[project]table topyproject.toml(required by uv), while preserving[tool.poetry]section for backward compatibility (versifier internally callspoetry export)setuptoolsandtyping_extensionsas dependencies (setuptools needed for Python 3.12+ which removeddistutils)uv tool install poetry+poetry-plugin-exportbecauseversifier extract-private-packagescallspoetry exportinternallypoetry lockruns in CI to keep the lock file in sync with the updated pyproject.toml for Poetry 2.xReview & Testing Checklist for Human
pyproject.tomlnow has both[project](PEP 621) and[tool.poetry]sections — verify these stay consistent and don't cause unexpected behavior with either uv or Poetrypoetry lockin CI: The lock file is regenerated in CI on every run, meaning the committedpoetry.lockmay not match what CI actually uses — consider whether this masks dependency resolution issuessetuptoolsas runtime dependency: Added to work arounddistutilsremoval in Python 3.12+ (versifier/compiler.pyimportsfrom distutils.core import setup) — consider whether refactoring the import is preferable to adding a runtime dependencypyproject.tomldeclaresrequires-python = ">=3.11"— verify this is intentional and aligns with project goals (drops support for Python 3.6–3.10)uv sync && uv run pytestlocally on Python 3.11, 3.12, and 3.13 to verify the full test suite passesRecommended Test Plan
uv syncto install dependenciesuv run pytest— expect 117 tests to passmake test checkto verify the full CI command works locallyNotes
_) which is acceptable for unit testing but worth notingextract-private-packagescommand — this is why Poetry is installed alongside uv in CILink to Devin run: https://app.devin.ai/sessions/2b89e39464164fe085c3208ff2b164d7
Requested by: 刘奕聪 (@MrLYC)