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 documentation for primer and convert to command line option #5387

Merged
merged 6 commits into from Nov 25, 2021

Conversation

DanielNoord
Copy link
Collaborator

@DanielNoord DanielNoord commented Nov 24, 2021

  • Add yourself to CONTRIBUTORS if you are a new contributor.
  • Write a good description on what the PR does.

Type of Changes

Type
✨ New feature
🔨 Refactoring
📜 Docs

Description

Based on https://docs.pytest.org/en/latest/example/simple.html#control-skipping-of-tests-according-to-command-line-option

Because we can remove the standard addopts IDEs like VS Code will now actually find all tests in our test suite, but will just skip them when running normally. Makes it easier (at least for those on VS Code) to explore all tests.

Ticks of two points from #5306

@coveralls
Copy link

coveralls commented Nov 24, 2021

Pull Request Test Coverage Report for Build 1502943571

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 93.499%

Totals Coverage Status
Change from base Build 1500123956: 0.0%
Covered Lines: 13995
Relevant Lines: 14968

💛 - Coveralls


def pytest_addoption(parser) -> None:
parser.addoption(
"--primer_stdlib",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"--primer_stdlib",
"--primer-stdlib",

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You can't mark with @pytest.mark.primer-stdlib so I thought I would keep consistency throughout the functions using it. Do you want me to change it anyway?

Copy link
Member

Choose a reason for hiding this comment

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

For CLI option I think the standard is -

help="Run primer stdlib tests",
)
parser.addoption(
"--primer_external",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"--primer_external",
"--primer-external",

There's a lot of other place to change, but it's hard to do in github.

doc/development_guide/testing.rst Outdated Show resolved Hide resolved
doc/development_guide/testing.rst Outdated Show resolved Hide resolved
@DanielNoord
Copy link
Collaborator Author

We still need to add the mark to the pytest command as otherwise the CI job will run all tests including the primer. I think the latest commit fixes the increased run time of primer in this PR.

@Pierre-Sassoulas
Copy link
Member

Pierre-Sassoulas commented Nov 25, 2021

We still need to add the mark to the pytest command as otherwise the CI job will run all tests including the primer

Wasn't the point of adopt that primer were not launched by default ? What am I missing ?

@DanielNoord
Copy link
Collaborator Author

We still need to add the mark to the pytest command as otherwise the CI job will run all tests including the primer. I think the latest commit fixes the increased run time of primer in this PR.

This has been fixed with dab1e03

Wasn't the point of adopt that primer were not launched by default ? What am I missing ?

With this implementation --primer-external is False by default. It looks in the item.keywords (decorators) and if primer_stdlib is in there it adds a skip. If the option is supplied this won't happen so the mark isn't skipped. We need to add -m primer_external to then tell it to only run the marked tests again.

Basically instead of not selecting the mark by default (and therefore not showing up in test collection) this makes it so the mark is skipped by default.

@Pierre-Sassoulas Pierre-Sassoulas merged commit aa048f7 into pylint-dev:main Nov 25, 2021
@DanielNoord DanielNoord deleted the pytest-mark branch November 25, 2021 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants