Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Stop converting the filename to lowercase #181

Merged
merged 3 commits into from
Apr 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/pydocstyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,6 @@ class Module(Definition):
module = property(lambda self: self)
all = property(lambda self: self._all)

def __init__(self, *args, **kwargs):
super(Module, self).__init__(*args, **kwargs)
self.name = self.name.lower()

def __str__(self):
return 'at module level'

Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_cases/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,5 +339,5 @@ def inner_function():
"""Do inner something."""
return 0

expect(__file__.lower() if __file__[-1] != 'c' else __file__[:-1].lower(),
expect(__file__ if __file__[-1] != 'c' else __file__[:-1],
'D100: Missing docstring in public module')
43 changes: 21 additions & 22 deletions src/tests/test_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,26 +253,25 @@ def test_token_stream():
assert stream.line == 1


def test_pep257():
@pytest.mark.parametrize('test_case', [
'test',
'unicode_literals',
'nested_class',
'capitalization',
'comment_after_def_bug',
'multi_line_summary_start',
])
def test_pep257(test_case):
"""Run domain-specific tests from test.py file."""
test_cases = (
'test',
'unicode_literals',
'nested_class',
'capitalization',
'comment_after_def_bug',
'multi_line_summary_start'
)
for test_case in test_cases:
case_module = __import__('test_cases.{0}'.format(test_case),
globals=globals(),
locals=locals(),
fromlist=['expectation'],
level=1)
results = list(check([os.path.join(os.path.dirname(__file__),
'test_cases', test_case + '.py')],
select=set(ErrorRegistry.get_error_codes())))
for error in results:
assert isinstance(error, Error)
results = set([(e.definition.name, e.message) for e in results])
assert case_module.expectation.expected == results
case_module = __import__('test_cases.{0}'.format(test_case),
globals=globals(),
locals=locals(),
fromlist=['expectation'],
level=1)
results = list(check([os.path.join(os.path.dirname(__file__),
'test_cases', test_case + '.py')],
select=set(ErrorRegistry.get_error_codes())))
for error in results:
assert isinstance(error, Error)
results = set([(e.definition.name, e.message) for e in results])
assert case_module.expectation.expected == results
6 changes: 3 additions & 3 deletions src/tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
__all__ = ()


class TestEnv(object):
class FakeTestEnv(object):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this name change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I'm happy to pull d99705e into a separate pull request. I just noticed it and fixed it while working on this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, this is because pytest tries to collect this class? Then it's fine to change the name. However, I don't like "fake" because is creates a real file system environment. How about InvocationEnv / StagingEnv / DeployEnv, etc.?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup - pytest tries to collect classes named Test*

"""An isolated environment where pydocstyle can be run.

Since running pydocstyle as a script is affected by local config files,
Expand Down Expand Up @@ -109,7 +109,7 @@ def install_package(request):

@pytest.yield_fixture(scope="function", params=('pydocstyle', 'pep257'))
def env(request):
with TestEnv(request.param) as test_env:
with FakeTestEnv(request.param) as test_env:
yield test_env

pytestmark = pytest.mark.usefixtures("install_package")
Expand Down Expand Up @@ -854,7 +854,7 @@ def foo():


def test_pep257_entry_point():
with TestEnv('pep257') as env:
with FakeTestEnv('pep257') as env:
_, err, code = env.invoke()
assert code == 0
assert 'Deprecation Warning' in err, err
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ commands=sphinx-build -b html . _build
pep8ignore =
test.py E701 E704
norecursedirs = docs .tox
addopts = -rw

[pep257]
inherit = false
Expand Down