Skip to content

Commit

Permalink
Updated tests to use pathlib
Browse files Browse the repository at this point in the history
  • Loading branch information
carsongee committed Oct 6, 2023
1 parent 4613bf2 commit db0edbe
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
12 changes: 6 additions & 6 deletions pytest_pylint/tests/test_pytest_pylint.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""
Unit testing module for pytest-pylint plugin
"""
import os
import pathlib
import re
from textwrap import dedent
from unittest import mock
Expand Down Expand Up @@ -312,8 +312,8 @@ def test_output_file(testdir):
"""Verify pylint report output"""
testdir.makepyfile("import sys")
testdir.runpytest("--pylint", "--pylint-output-file=pylint.report")
output_file = os.path.join(testdir.tmpdir.strpath, "pylint.report")
assert os.path.isfile(output_file)
output_file = pathlib.Path(testdir.tmpdir.strpath) / "pylint.report"
assert output_file.is_file()

with open(output_file, "r", encoding="utf-8") as _file:
report = _file.read()
Expand All @@ -339,10 +339,10 @@ def test_output_file(testdir):
def test_output_file_makes_dirs(testdir):
"""Verify output works with folders properly."""
testdir.makepyfile("import sys")
output_path = os.path.join("reports", "pylint.report")
output_path = pathlib.Path("reports", "pylint.report")
testdir.runpytest("--pylint", f"--pylint-output-file={output_path}")
output_file = os.path.join(testdir.tmpdir.strpath, output_path)
assert os.path.isfile(output_file)
output_file = pathlib.Path(testdir.tmpdir.strpath) / output_path
assert output_file.is_file()
# Run again to make sure we don't crash trying to make a dir that exists
testdir.runpytest("--pylint", f"--pylint-output-file={output_path}")

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
packages=["pytest_pylint"],
entry_points={"pytest11": ["pylint = pytest_pylint.plugin"]},
python_requires=">=3.7",
install_requires=["pytest>=7.0", "pylint>=2.13.0", "toml>=0.7.1"],
install_requires=["pytest>=7.0", "pylint>=2.15.0", "toml>=0.7.1"],
setup_requires=["pytest-runner"],
tests_require=["coverage", "flake8", "black", "isort"],
classifiers=[
Expand Down
7 changes: 3 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
envlist =
py3{8, 9, 10}-pylint{213, 30}-pytest{7}
py3{8, 9, 10, 11}-pylint{213, latest, main}-pytest{7, latest, main}
py3{8, 9, 10}-pylint{215, 30}-pytest{7}
py3{8, 9, 10, 11}-pylint{215, latest, main}-pytest{7, latest, main}
py3{12}-pylint{latest, main}-pytest{7, latest, main}
coverage
qa
Expand All @@ -10,8 +10,7 @@ skip_missing_interpreters = true
[testenv]
usedevelop = true
deps =
pylint213: pylint~=2.13.9
pylint214: pylint~=2.14.5
pylint215: pylint~=2.15.10
pylint30: pylint~=3.0
pylintlatest: pylint
pylintmain: git+https://github.com/PyCQA/pylint.git@main#egg=pylint
Expand Down

0 comments on commit db0edbe

Please sign in to comment.