mirror of
https://github.com/PyCQA/flake8.git
synced 2026-03-30 02:46:52 +00:00
Add config file fixtures
Add more ConfigFileFinder tests
This commit is contained in:
parent
8dd160c98e
commit
dd46f02b58
2 changed files with 27 additions and 1 deletions
9
tests/fixtures/config_files/cli-specified.ini
vendored
Normal file
9
tests/fixtures/config_files/cli-specified.ini
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[flake8]
|
||||
ignore =
|
||||
E123,
|
||||
W234,
|
||||
E111
|
||||
exclude =
|
||||
foo/,
|
||||
bar/,
|
||||
bogus/
|
||||
|
|
@ -1,5 +1,8 @@
|
|||
"""Tests for the ConfigFileFinder."""
|
||||
import os
|
||||
import sys
|
||||
|
||||
import mock
|
||||
|
||||
from flake8.options import config
|
||||
|
||||
|
|
@ -7,5 +10,19 @@ from flake8.options import config
|
|||
def test_uses_default_args():
|
||||
"""Show that we default the args value."""
|
||||
finder = config.ConfigFileFinder('flake8', None, [])
|
||||
assert finder.args == ['.']
|
||||
assert finder.parent == os.path.abspath('.')
|
||||
|
||||
|
||||
@mock.patch.object(sys, 'platform', 'win32')
|
||||
def test_windows_detection():
|
||||
"""Verify we detect Windows to the best of our knowledge."""
|
||||
finder = config.ConfigFileFinder('flake8', None, [])
|
||||
assert finder.is_windows is True
|
||||
|
||||
|
||||
def test_cli_config():
|
||||
cli_filepath = 'tests/fixtures/config_files/cli-specified.ini'
|
||||
finder = config.ConfigFileFinder('flake8', None, [])
|
||||
|
||||
parsed_config = finder.cli_config(cli_filepath)
|
||||
assert parsed_config.has_section('flake8')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue