Migrate existing unit tests to pytest. #20
No reviewers
Labels
No labels
area/ai-removal
area/build
area/meta
bug
contribution welcome
duplicate
good first issue
help wanted
invalid
question
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
rereading/arcalibre!20
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "cgranade/pytest"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The original Calibre package used an ad-hoc test discovery framework, wherein each module under test defines a
find_testsfunction that is then called by an eventual test harness command inmake.py. This causes issues such as #19, wherein some modes of test failure can propagate to errors in the test harness itself, preventing any unit tests from being run.This PR addresses #19 by moving unit tests into a separate folder that depends on the
calibrepackage and onpytest. This in turn requires removing the pre-existing hack wherein therun-localscript would add attributes to thesysmodule, when would then be used by other modules such ascalibre.constantsor the extensions meta-loader. Modifyingsysin place prevented the import of thecalibrepackage from a unit-testing context, and makes it more difficult to extract subpackages and modules into standalone wheels.This PR does not attempt to get failing unit tests to pass, beyond very basic fixes — rather, the focus is on getting unit tests to run at all, so that regressions can be found when refactoring other parts of Calibre into the Arcalibre codebase.
This PR is marked as WIP until all tests have been migrated so that an accurate picture can be reached as to how many pre-existing tests currently fail.
Many of the tests remain broken, and I'm sure I introduced some bugs along the way, but here's the final score for having moved all Python tests into a pytest suite:
tydiagnosticsruffdiagnostics that can't be fixed with--fixWIP: Migrate existing unit tests to pytest.to Migrate existing unit tests to pytest.Fixes #19.
Since multiple people have given this a try and confirmed that it works locally (in that it runs and returns a list of failed tests), I'm pretty confident with merging this in now to make it easier to test other PRs. Thank you so much to @SnoopJ and @cthos!