Пример #1
0
def test_version_is_raised(reset_sys_argv, flag):
    """Ensure the version info is raised with SystemExit when requested."""

    sys.argv = ["py-build", flag]
    with pytest.raises(SystemExit) as error:
        pypackage_setup()
    assert error.value.args[0] == pypackage.VERSION
Пример #2
0
def test_help_is_raised(reset_sys_argv, flag):
    """Ensure additional help is shimmed inside the help msg per function."""

    sys.argv = ["py-build", flag]
    with pytest.raises(SystemExit) as error:
        pypackage_setup(additional="super important information")
    assert "super important information" in error.value.args[0]
Пример #3
0
def test_version_is_raised(reset_sys_argv, flag):
    """Ensure the version info is raised with SystemExit when requested."""

    sys.argv = ["py-build", flag]
    with pytest.raises(SystemExit) as error:
        pypackage_setup()
    assert error.value.args[0] == pypackage.VERSION
Пример #4
0
def test_help_is_raised(reset_sys_argv, flag):
    """Ensure additional help is shimmed inside the help msg per function."""

    sys.argv = ["py-build", flag]
    with pytest.raises(SystemExit) as error:
        pypackage_setup(additional="super important information")
    assert "super important information" in error.value.args[0]
Пример #5
0
def test_reclassify_trigger(simple_module, reset_sys_argv, flag):
    """Ensure set_value_in_config is called for classifiers if requested."""

    sys.argv = ["py-build", "-N", flag]
    with mock.patch.object(pypackage, "set_value_in_config") as set_v_patch:
        pypackage_setup()

    assert set_v_patch.call_count == 1
Пример #6
0
def test_reclassify_trigger(simple_module, reset_sys_argv, flag):
    """Ensure set_value_in_config is called for classifiers if requested."""

    sys.argv = ["py-build", "-N", flag]
    with mock.patch.object(pypackage, "set_value_in_config") as set_v_patch:
        pypackage_setup()

    assert set_v_patch.call_count == 1
Пример #7
0
def test_interactive_setup_called(capfd, simple_module, reset_sys_argv, flag):
    """Ensure we call run_interactive_setup when requested."""

    sys.argv = ["py-build", "-N", flag]
    with mock.patch.object(pypackage, "run_interactive_setup") as inter_patch:
        pypackage_setup()

    assert inter_patch.call_count == 1

    out, err = capfd.readouterr()
    assert "~ setup.py ~" in out
    assert "from setuptools import setup" in out
    assert "setup(" in out
    assert not err
Пример #8
0
def test_interactive_setup_called(capfd, simple_module, reset_sys_argv, flag):
    """Ensure we call run_interactive_setup when requested."""

    sys.argv = ["py-build", "-N", flag]
    with mock.patch.object(pypackage, "run_interactive_setup") as inter_patch:
        pypackage_setup()

    assert inter_patch.call_count == 1

    out, err = capfd.readouterr()
    assert "~ setup.py ~" in out
    assert "from setuptools import setup" in out
    assert "setup(" in out
    assert not err