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

Test via pylint #35

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Test custom violation format (#34)
- Test via pylint (#35)

## [0.4.0] - 2024-06-13

Expand Down
24 changes: 23 additions & 1 deletion tests/it/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def _test_repo(tmpdir_factory: TempdirFactory, current_dir: str) -> Generator[No
os.chdir(tmp_path / 'ondivi-test-repo')
subprocess.run(['python', '-m', 'venv', 'venv'], check=True)
subprocess.run(['venv/bin/pip', 'install', 'pip', '-U'], check=True)
subprocess.run(['venv/bin/pip', 'install', 'flake8', 'ruff', 'mypy', str(current_dir)], check=True)
subprocess.run(['venv/bin/pip', 'install', 'flake8', 'ruff', 'mypy', 'pylint', str(current_dir)], check=True)
yield
os.chdir(current_dir)

Expand Down Expand Up @@ -162,6 +162,28 @@ def test_ruff() -> None:
assert got.returncode == 1


@pytest.mark.usefixtures('_test_repo')
def test_pylint() -> None:
"""Test pylint."""
got = subprocess.run(
['venv/bin/ondivi'],
stdin=subprocess.Popen(
['venv/bin/pylint', 'file.py'],
stdout=subprocess.PIPE,
).stdout,
stdout=subprocess.PIPE,
check=False,
)

assert got.stdout.decode('utf-8').strip() == '\n'.join([
'************* Module file',
'file.py:12:0: C0301: Line too long (119/100) (line-too-long)',
'',
'------------------------------------------------------------------',
])
assert got.returncode == 1


@pytest.mark.usefixtures('_test_repo')
def test_mypy() -> None:
"""Test mypy."""
Expand Down