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

Add tox and change coverage configuration #311

Merged
merged 4 commits into from
Feb 24, 2022

Conversation

egpbos
Copy link
Member

@egpbos egpbos commented Feb 22, 2022

This PR changes two things:

  1. It adds tox support, which provides a fix for Installing development tools #38 and is just generally nice to have (I personally always add it).
  2. It takes out the coverage flags from the default pytest settings. The coverage flags were breaking IDE test discovery. Instead, coverage can just be run separately with coverage or by supplying the flags manually, like is being done in the sonarcloud Actions workflow.

Edit: also updated a broken link.

By making testing and coverage separate parts of the configuration, VSCode no longer chokes on discovering tests. This should also make test discovery easier in IDEs like PyCharm. The main problem was that coverage was being treated as default part of testing by always passing coverage flags to pytest (this was also noted in a comment in setup.cfg). Moving this to pyproject.toml may have been unnecessary in the end, but the resources I found online suggested this
was the way to go.

Adding tox provides a solution to NLeSC#38.
@egpbos egpbos requested a review from sverhoeven February 22, 2022 10:25
egpbos added a commit to egpbos/kwandl that referenced this pull request Feb 22, 2022
Copy link
Member

@sverhoeven sverhoeven left a comment

Choose a reason for hiding this comment

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

I depend on GH action to run my tests with different pythons, but doing it locally with tox is helpful.

Can you document a bit the usage of tox and pytest+coverage in the README.dev.md? Now that pytest does not automatically do coverage we should tell the template user about it in another way.

@egpbos
Copy link
Member Author

egpbos commented Feb 24, 2022

@sverhoeven Added documentation in 6d78d07.

Copy link
Member

@sverhoeven sverhoeven left a comment

Choose a reason for hiding this comment

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

LGTM

@egpbos egpbos merged commit 57a1321 into NLeSC:main Feb 24, 2022
egpbos added a commit that referenced this pull request Mar 20, 2022
In #311, I forgot to add the .tox directory to .gitignore. Tox stores environments and logs and such there.
@egpbos egpbos mentioned this pull request Mar 20, 2022
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.

3 participants