-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(poetry): consider all groups for dev dependencies (#392)
- Loading branch information
1 parent
6724063
commit a10ef26
Showing
7 changed files
with
229 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[virtualenvs] | ||
in-project = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[tool.poetry] | ||
name = "test" | ||
version = "0.0.1" | ||
description = "A test project" | ||
authors = ["test <test@test.com>"] | ||
|
||
[tool.poetry.dependencies] | ||
python = ">=3.7" | ||
pkginfo = ">=1.8.3" | ||
toml = "*" | ||
urllib3 = ">=1.26.12" | ||
|
||
click = { version = ">=8.1.3", optional = true } | ||
isort = { version = ">=5.10.1", optional = true } | ||
requests = { version = ">=2.28.1", optional = true } | ||
|
||
[tool.poetry.extras] | ||
foo = [ | ||
"click", | ||
"isort", | ||
] | ||
bar = ["requests"] | ||
|
||
[tool.poetry.group.lint.dependencies] | ||
black = "^22.6.0" | ||
mypy = "^1.3.0" | ||
|
||
[tool.poetry.group.test.dependencies] | ||
pytest = "^7.3.0" | ||
pytest-cov = "^4.0.0" | ||
|
||
[tool.deptry] | ||
ignore_unused = ["pkginfo"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from os import chdir, walk | ||
from pathlib import Path | ||
|
||
import black | ||
import click | ||
import mypy | ||
import pytest | ||
import pytest_cov | ||
import white as w | ||
from urllib3 import contrib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "9f4924ec-2200-4801-9d49-d4833651cbc4", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import click\n", | ||
"from urllib3 import contrib\n", | ||
"import toml" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.9.11" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
from __future__ import annotations | ||
|
||
from pathlib import Path | ||
from typing import TYPE_CHECKING | ||
|
||
from click.testing import CliRunner | ||
|
||
from deptry.cli import deptry | ||
from tests.utils import get_issues_report, run_within_dir | ||
|
||
if TYPE_CHECKING: | ||
from tests.functional.types import ToolSpecificProjectBuilder | ||
|
||
|
||
def test_cli_with_poetry(poetry_project_builder: ToolSpecificProjectBuilder) -> None: | ||
with run_within_dir(poetry_project_builder("project_with_poetry")): | ||
result = CliRunner().invoke(deptry, ". -o report.json") | ||
|
||
assert result.exit_code == 1 | ||
assert get_issues_report() == [ | ||
{ | ||
"error": { | ||
"code": "DEP002", | ||
"message": "'isort' defined as a dependency but not used in the codebase", | ||
}, | ||
"module": "isort", | ||
"location": { | ||
"file": str(Path("pyproject.toml")), | ||
"line": None, | ||
"column": None, | ||
}, | ||
}, | ||
{ | ||
"error": { | ||
"code": "DEP002", | ||
"message": "'requests' defined as a dependency but not used in the codebase", | ||
}, | ||
"module": "requests", | ||
"location": { | ||
"file": str(Path("pyproject.toml")), | ||
"line": None, | ||
"column": None, | ||
}, | ||
}, | ||
{ | ||
"error": { | ||
"code": "DEP004", | ||
"message": "'black' imported but declared as a dev dependency", | ||
}, | ||
"module": "black", | ||
"location": { | ||
"file": str(Path("src/main.py")), | ||
"line": 4, | ||
"column": 0, | ||
}, | ||
}, | ||
{ | ||
"error": { | ||
"code": "DEP004", | ||
"message": "'mypy' imported but declared as a dev dependency", | ||
}, | ||
"module": "mypy", | ||
"location": { | ||
"file": str(Path("src/main.py")), | ||
"line": 6, | ||
"column": 0, | ||
}, | ||
}, | ||
{ | ||
"error": { | ||
"code": "DEP004", | ||
"message": "'pytest' imported but declared as a dev dependency", | ||
}, | ||
"module": "pytest", | ||
"location": { | ||
"file": str(Path("src/main.py")), | ||
"line": 7, | ||
"column": 0, | ||
}, | ||
}, | ||
{ | ||
"error": { | ||
"code": "DEP004", | ||
"message": "'pytest_cov' imported but declared as a dev dependency", | ||
}, | ||
"module": "pytest_cov", | ||
"location": { | ||
"file": str(Path("src/main.py")), | ||
"line": 8, | ||
"column": 0, | ||
}, | ||
}, | ||
{ | ||
"error": { | ||
"code": "DEP001", | ||
"message": "'white' imported but missing from the dependency definitions", | ||
}, | ||
"module": "white", | ||
"location": { | ||
"file": str(Path("src/main.py")), | ||
"line": 9, | ||
"column": 0, | ||
}, | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters