mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-10 14:54:17 +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."""
|
"""Tests for the ConfigFileFinder."""
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import mock
|
||||||
|
|
||||||
from flake8.options import config
|
from flake8.options import config
|
||||||
|
|
||||||
|
|
@ -7,5 +10,19 @@ from flake8.options import config
|
||||||
def test_uses_default_args():
|
def test_uses_default_args():
|
||||||
"""Show that we default the args value."""
|
"""Show that we default the args value."""
|
||||||
finder = config.ConfigFileFinder('flake8', None, [])
|
finder = config.ConfigFileFinder('flake8', None, [])
|
||||||
assert finder.args == ['.']
|
|
||||||
assert finder.parent == os.path.abspath('.')
|
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