-
-
Notifications
You must be signed in to change notification settings - Fork 67
Fixed multiple issues related to blocks and the lmove
command
#506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Added `--keep-page-size` option to `grid` command - API: removed `temp_document()` context manager from `vpype_cli.State()` as it was a faulty construct - API: added equality operator to `vpype.LineCollection` and `vpype.Document` (useful for writing tests) - Fixed issue where certain nested commands could lead totally unexpected results with blocks - Fixed issue with the `lmove` command where order would not be respected in certain case (such as `lmove all 2`, content of layer 2 wasn't placed after content of layer 1) - Fixed issue where expressions could not use some variable name corresponding to units (e.g. `m`). Expressions may now reuse these variable name (but that would obviously affect their subsequent use). - Improved implementation of `vpype_cli.execute()` - Test: added `data/test_vpy` directory where all .vpy are executed and checked against reference SVGs (using the `reference_svg` fixture). - Tests misc: * added set_current_directory context manager * added make_line_collection factory fixture * added make_document factory fixture * moved block-related tests to `test_block.py` * expanded block-related tests
- Added generation of error report when `reference_svg` fixture fails - Improved test case naming - Updated ref SVGs - Updated CI to save artifacts
This makes the tests more predictable.
Codecov Report
@@ Coverage Diff @@
## master #506 +/- ##
==========================================
+ Coverage 94.44% 94.69% +0.24%
==========================================
Files 61 63 +2
Lines 5457 5636 +179
Branches 795 810 +15
==========================================
+ Hits 5154 5337 +183
+ Misses 185 182 -3
+ Partials 118 117 -1
Continue to review full report at Codecov.
|
Kudos, SonarCloud Quality Gate passed!
|
Description
This PR aims to address multiple issues which arise from the discussion in #487, and in particular the "paint well" command listed in #501.
The first issue is a bug in blocks which, due to the structurally faulty
vpype_cli.State.temp_document()
context manager, could disregard the outcome of the nested commands if one such command changed the pipeline'svp.Document
instance. This is solved by suppressing said context manager and rewriting the block commands' code.A new
--keep-page-size
option has been added to thegrid
command in the process (helps for tests).Another issue is the order of the
lmove
command when used likelmove all 2
. Previously, the resulting ordering would be: [layer 2 content, layer 1 content, layer 3 content, etc.]. This would break the intended "paint well" pipeline. This PR fixeslmove
such that the order is instead [layer 1 content, layer 2 content, layer 3 content, ...].Finally, another minor issue was the read-only nature of the unit variable in expressions, in particular the newly introduced
m
. This meant that am
variable couldn't be created, leading to a confusing message. These variables are now no longer marked as read-only, and can be overwritten by expressions (with the caveat that this would, of course, break their functionality).To address these issues and changes, multiple tests have been added, as well as the scaffolding to automatically check the consistency of output for a collection of
.vpy
files. New test case can now be added simply by adding new.vpy
files.Fixes #501
Checklist
black
andisort
)mypy
returns no errorpytest
succeedshelp
reference.rst
make clean && make html
indocs/
)