Issue 2570 devcontainer ruff, black and pytest #2595
Merged
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.
Fixes #2570
Adding
--ruff
to thepytest
configuration inpyproject.toml
adversely affects thedevcontainer
: the Testing view does not load properly (tests are discovered but not listed). It is convenient to have those tests loaded in the Testing view for debugging and troubleshooting, allowing the developer to isolate and repeatedly run individual files/tests quickly.One important caveat is the devcontainer creates its own
.pytest.ini
file (it is gitgnored) which overrides the configuration in pyproject.toml.ruff
will ignore this file and continue to use the pyproject configuration. Theruff
extension is also explicitly configured to use the pyproject configuration. Creating a.pytest.ini
file when the container is built means that file will continue to exist on the file system outside of the container. So if a developer flips between using the devcontainer and running commands directly on their system they will pick up the.pytest.ini
file which would not runruff
check when callingpython -m pytest .
on the local machine. These changes do NOT impact./scripts/run_tests
or./scripts/run_tests_indy
- those will continue to use the pyproject configuration.This PR adds extensions for
ruff
andblack
, setting upblack
as the default formatted and integratingruff
into the editor/command palette.Updates have been made to the devcontainer README to inform users/developers of the changes and caveats.
NOTE - the
ruff
version has been updated to match the extension.