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

tests fail when git python module isn't installed #5486

Closed
paper42 opened this issue Dec 6, 2021 · 3 comments · Fixed by #5842
Closed

tests fail when git python module isn't installed #5486

paper42 opened this issue Dec 6, 2021 · 3 comments · Fixed by #5842
Assignees
Labels
Milestone

Comments

@paper42
Copy link
Contributor

paper42 commented Dec 6, 2021

Bug description

Run pytest without having the git python module installed, they will fail on import git:

https://github.com/PyCQA/pylint/blob/5e9d20dc32768e873ab84bc4ed0b489fdda40672/pylint/testutils/primer.py#L1-L10

cc @Pierre-Sassoulas

Configuration

No response

Command used

pytest

Pylint output

-

Expected behavior

Tests which require git python module are skipped on systems without this module.

Pylint version

pylint 2.12.2
astroid 2.9.0
Python 3.10.0 (default, Oct 25 2021, 19:14:18) [GCC 10.2.1 20201203]

OS / Environment

No response

Additional dependencies

No response

@paper42 paper42 added Bug 🪲 Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Dec 6, 2021
@Pierre-Sassoulas Pierre-Sassoulas removed the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Dec 6, 2021
@Pierre-Sassoulas
Copy link
Member

We added git python to the tests requirements when we added primer, but they are indeed used in pylint.testutils. So they should be a pylint runtime dependency.

I'd hate to do that though, most user do not need testutils and only use pylint as a linter a not as a lib that they extend.

I think we could create a separate package pylint-testutils so it does not pollute pylint's dependencies. Another advantage would be that we can do major when we break something in pylint.testutil instead of what we're doing right now (consider that it's not a public API). What do you think @DanielNoord @cdce8p ?

@cdce8p
Copy link
Member

cdce8p commented Dec 6, 2021

So they should be a pylint runtime dependency.

pylint.testutils isn't a runtime dependency. It works just fine for Home-Assistant. Only if you want to use the pylint test interface is it required.

A separate package is a lot of work even if we automate most of it. I would suggest extras_require for it. Users could then do install it like this. (We can obviously change the name.)

pip install pylint[test-lib]

https://setuptools.pypa.io/en/latest/userguide/dependency_management.html#optional-dependencies

@Pierre-Sassoulas
Copy link
Member

pip install pylint[testutil] does sound like the best of both world, I like that.

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 a pull request may close this issue.

3 participants