Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • pycqa/pydocstyle
1 result
Show changes
Commits on Source (9)
Loading
Loading
@@ -25,6 +25,8 @@ Bug Fixes
* Fixed an issue where if a first word in a docstring had Unicode characters
and the docstring was not a unicode string, an exception would be raised
(#258, #264).
* Configuration files that were specified by CLI and don't contain a valid
section name will now issue a warning to ``stderr`` (#276, #280).
 
 
2.0.0 - April 18th, 2017
Loading
Loading
Loading
Loading
@@ -256,10 +256,17 @@ class ConfigurationParser(object):
raise IllegalConfiguration('Configuration file {!r} specified '
'via --config was not found.'
.format(self._run_conf.config))
if None in self._cache:
return self._cache[None]
options, _ = self._read_configuration_file(self._run_conf.config)
config = self._create_check_config(options)
if options is None:
log.warning('Configuration file does not contain a '
'pydocstyle section. Using default configuration.')
config = self._create_check_config(self._options)
else:
config = self._create_check_config(options)
 
# Make the CLI always win
final_config = {}
Loading
Loading
Loading
Loading
@@ -251,6 +251,32 @@ def test_config_file(env):
assert 'D103' not in err
 
 
def test_sectionless_config_file(env):
"""Test that config files without a valid section name issue a warning."""
with env.open('config.ini', 'wt') as conf:
conf.write('[pdcstl]')
config_path = conf.name
_, err, code = env.invoke('--config={}'.format(config_path))
assert code == 0
assert 'Configuration file does not contain a pydocstyle section' in err
with env.open('example.py', 'wt') as example:
example.write(textwrap.dedent("""\
def foo():
pass
"""))
with env.open('tox.ini', 'wt') as conf:
conf.write('[pdcstl]\n')
conf.write('ignore = D100')
out, err, code = env.invoke()
assert code == 1
assert 'D100' in out
assert 'file does not contain a pydocstyle section' not in err
def test_config_path(env):
"""Test that options are correctly loaded from a specific config file.
 
Loading
Loading