Skip to content

Commit

Permalink
Added test for when custom TOML config file not found.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-hen committed Nov 17, 2022
1 parent 1b06013 commit a1d35d8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""Integration tests for the package."""

from pathlib import Path
from subprocess import PIPE, run
from subprocess import run, PIPE, STDOUT
from sys import executable as python

from pytest import mark


expected = r"""
module.py:1:71: E501 line too long (77 > 70 characters)
module.py:5:14: E221 multiple spaces before operator
Expand All @@ -16,7 +16,8 @@
def capture(command, folder):
if isinstance(folder, str):
folder = Path(__file__).parent/'fixtures'/folder
process = run(command, stdout=PIPE, universal_newlines=True, cwd=folder)
process = run(command, stdout=PIPE, stderr=STDOUT,
universal_newlines=True, cwd=folder)
# From Python 3.7 on, use `text=True` instead of `universal newlines`.
return process.stdout.strip()

Expand Down Expand Up @@ -61,6 +62,10 @@ def test_config_toml(command):
output = capture([command, f'--toml-config={file.resolve()}', 'module.py'],
'config_toml')
assert output == expected
file = file.with_name('does_not_exist.toml')
assert not file.exists()
output = capture([command, f'--toml-config={file.name}'], 'config_toml')
assert 'FileNotFoundError' in output


@mark.parametrize('command', ['flake8', 'flake8p'])
Expand Down

0 comments on commit a1d35d8

Please sign in to comment.