Ejemplo n.º 1
0
def test_check_unknown(tmp_path, capsys):
    setup_py = tmp_path / "setup.py"
    setup_py.write_text(textwrap.dedent("""\
        from setuptools import setup
        setup(
            name='foo',
        )
    """))
    assert cpv.check(tmp_path) is True
    assert capsys.readouterr().out == textwrap.dedent("""\
        setup.py says:              (empty)
    """)
Ejemplo n.º 2
0
def test_check_minimal(tmp_path, capsys):
    setup_py = tmp_path / "setup.py"
    setup_py.write_text(textwrap.dedent("""\
        from setuptools import setup
        setup(
            name='foo',
            classifiers=[
                'Programming Language :: Python :: 2.7',
                'Programming Language :: Python :: 3.6',
            ],
        )
    """))
    assert cpv.check(tmp_path) is True
    assert capsys.readouterr().out == textwrap.dedent("""\
        setup.py says:              2.7, 3.6
    """)
Ejemplo n.º 3
0
def test_check_expectation(tmp_path, capsys):
    setup_py = tmp_path / "setup.py"
    setup_py.write_text(textwrap.dedent("""\
        from setuptools import setup
        setup(
            name='foo',
            classifiers=[
                'Programming Language :: Python :: 2.7',
                'Programming Language :: Python :: 3.6',
            ],
        )
    """))
    assert cpv.check(tmp_path, expect=['2.7', '3.6', '3.7']) is False
    assert capsys.readouterr().out == textwrap.dedent("""\
        setup.py says:              2.7, 3.6
        expected:                   2.7, 3.6, 3.7
    """)
Ejemplo n.º 4
0
def test_check_mismatch(tmp_path, capsys):
    setup_py = tmp_path / "setup.py"
    setup_py.write_text(textwrap.dedent("""\
        from setuptools import setup
        setup(
            name='foo',
            classifiers=[
                'Programming Language :: Python :: 2.7',
                'Programming Language :: Python :: 3.6',
            ],
        )
    """))
    tox_ini = tmp_path / "tox.ini"
    tox_ini.write_text(textwrap.dedent("""\
        [tox]
        envlist = py27
    """))
    assert cpv.check(tmp_path) is False
    assert capsys.readouterr().out == textwrap.dedent("""\
        setup.py says:              2.7, 3.6
        tox.ini says:               2.7
    """)
Ejemplo n.º 5
0
def test_check_not_a_package(tmp_path, capsys):
    assert cpv.check(tmp_path) is None
    assert capsys.readouterr().out == 'no setup.py -- not a Python package?\n'
Ejemplo n.º 6
0
def test_check_not_a_directory(tmp_path, capsys):
    assert cpv.check(tmp_path / "xyzzy") is None
    assert capsys.readouterr().out == 'not a directory\n'