mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-12 07:44:16 +00:00
Merge branch 'bug/295' into 'master'
Return similarly named, non-submodule modules Closes #295 See merge request !170
This commit is contained in:
commit
f7c01db9ba
2 changed files with 35 additions and 1 deletions
|
|
@ -66,7 +66,7 @@ class Flake8(setuptools.Command):
|
||||||
if package_directory.startswith(seen_package_directories):
|
if package_directory.startswith(seen_package_directories):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
seen_package_directories += (package_directory,)
|
seen_package_directories += (package_directory + '.',)
|
||||||
yield package_directory
|
yield package_directory
|
||||||
|
|
||||||
def module_files(self):
|
def module_files(self):
|
||||||
|
|
|
||||||
34
tests/unit/test_setuptools_command.py
Normal file
34
tests/unit/test_setuptools_command.py
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
"""Module containing tests for the setuptools command integration."""
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from setuptools import dist
|
||||||
|
|
||||||
|
from flake8.main import setuptools_command
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def distribution():
|
||||||
|
"""Create a setuptools Distribution object."""
|
||||||
|
return dist.Distribution({
|
||||||
|
'name': 'foo',
|
||||||
|
'packages': [
|
||||||
|
'foo',
|
||||||
|
'foo.bar',
|
||||||
|
'foo_biz',
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def command(distribution):
|
||||||
|
"""Create an instance of Flake8's setuptools command."""
|
||||||
|
return setuptools_command.Flake8(distribution)
|
||||||
|
|
||||||
|
|
||||||
|
def test_package_files_removes_submodules(command):
|
||||||
|
"""Verify that we collect all package files."""
|
||||||
|
package_files = list(command.package_files())
|
||||||
|
assert sorted(package_files) == [
|
||||||
|
'foo',
|
||||||
|
'foo_biz',
|
||||||
|
]
|
||||||
Loading…
Add table
Add a link
Reference in a new issue