summaryrefslogtreecommitdiff
path: root/tests/unit/test_setuptools_command.py
blob: c8da0d23ba5e9e2a8136cf82be092dd4e3b8ecb9 (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
from isort import setuptools_commands


def test_isort_command_smoke(src_dir):
    """A basic smoke test for the setuptools_commands command"""
    from distutils.dist import Distribution

    command = setuptools_commands.ISortCommand(Distribution())
    command.distribution.packages = ["isort"]
    command.distribution.package_dir = {"isort": src_dir}
    command.initialize_options()
    command.finalize_options()
    try:
        command.run()
    except BaseException:
        pass

    command.distribution.package_dir = {"": "isort"}
    command.distribution.py_modules = ["one", "two"]
    command.initialize_options()
    command.finalize_options()
    command.run()

    command.distribution.packages = ["not_a_file"]
    command.distribution.package_dir = {"not_a_file": src_dir}
    command.initialize_options()
    command.finalize_options()
    try:
        command.run()
    except BaseException:
        pass