Skip to content
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

Issue 2570 devcontainer ruff, black and pytest #2595

Conversation

usingtechnology
Copy link
Contributor

@usingtechnology usingtechnology commented Nov 6, 2023

Fixes #2570

Adding --ruff to the pytest configuration in pyproject.toml adversely affects the devcontainer: 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. The ruff 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 run ruff check when calling python -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 and black, setting up black as the default formatted and integrating ruff 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.

Copy link

sonarcloud bot commented Nov 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@usingtechnology usingtechnology changed the title Issue 2570 devcontainer ruff Issue 2570 devcontainer ruff, black and pytest Nov 6, 2023
Copy link
Contributor

@dbluhm dbluhm left a comment

Choose a reason for hiding this comment

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

I haven't tested this myself but happy to rubberstamp it.

@swcurran swcurran merged commit 02ecb2d into openwallet-foundation:main Nov 8, 2023
9 checks passed
@ianco
Copy link
Contributor

ianco commented Nov 8, 2023

@usingtechnology any way you could merge these changes into the anoncreds-rs branch? I did a quick check and there are a few conflicts.

@usingtechnology usingtechnology deleted the issue-2570-devcontainer-ruff branch November 8, 2023 16:33
@usingtechnology
Copy link
Contributor Author

@usingtechnology any way you could merge these changes into the anoncreds-rs branch? I did a quick check and there are a few conflicts.

If that branch is stable today, I can take a crack at it. Probably not too far off...

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.

devcontainer, pytest and ruff
4 participants