summaryrefslogtreecommitdiff
path: root/tests/unit/test_setuptools_command.py
blob: 40c9733d038cc1bc8ec7247473fba4de289d1a70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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',
    ]