예제 #1
0
def test_project_with_wrong_setup(tmpdir):  # noqa
    os.mkdir("my_project")
    open("my_project/setup.py", 'a').close()
    args = ["my_project"]
    args = cli.parse_args(args)
    with pytest.raises(RuntimeError):
        info.project(args)
예제 #2
0
def test_project_with_no_versioneer(tmpdir):
    os.mkdir("my_project")
    open("my_project/setup.py", 'a').close()
    args = ["my_project"]
    args = runner.parse_args(args)
    with pytest.raises(IOError):
        info.project(args)
예제 #3
0
def test_project_with_wrong_setup(tmpfolder):
    os.mkdir("my_project")
    open("my_project/setup.py", "a").close()
    args = ["my_project"]
    opts = cli.parse_args(args)
    with pytest.raises(FileNotFoundError):
        info.project(opts)
예제 #4
0
def test_project_with_no_versioneer(tmpdir):
    os.mkdir("my_project")
    open("my_project/setup.py", 'a').close()
    args = ["my_project"]
    args = runner.parse_args(args)
    with pytest.raises(IOError):
        info.project(args)
예제 #5
0
def test_project_with_no_setup(tmpfolder):
    os.mkdir("my_project")
    args = ["my_project"]
    opts = cli.parse_args(args)
    opts = cli.process_opts(opts)
    with pytest.raises(FileNotFoundError):
        info.project(opts)
예제 #6
0
def test_project_with_wrong_setup(tmpdir):  # noqa
    os.mkdir("my_project")
    open("my_project/setup.py", 'a').close()
    args = ["my_project"]
    args = cli.parse_args(args)
    with pytest.raises(RuntimeError):
        info.project(args)
예제 #7
0
def test_project_with_wrong_setup(tmpdir):
    os.mkdir("my_project")
    open("my_project/versioneer.py", 'a').close()
    open("my_project/setup.py", 'a').close()
    args = ["my_project"]
    args = runner.parse_args(args)
    with pytest.raises(AttributeError):
        info.project(args)
예제 #8
0
def test_project_with_wrong_setup(tmpdir):
    os.mkdir("my_project")
    open("my_project/versioneer.py", 'a').close()
    open("my_project/setup.py", 'a').close()
    args = ["my_project"]
    args = runner.parse_args(args)
    with pytest.raises(AttributeError):
        info.project(args)
예제 #9
0
def test_project_with_junit_coverage_args_overwritten(tmpdir):
    old_args = ["my_project"]
    runner.main(old_args)
    args = ["my_project", "--with-junit-xml", "--with-coverage-xml",
            "--with-coverage-html"]
    args = runner.parse_args(args)
    new_args = info.project(args)
    assert new_args.junit_xml is True
    assert new_args.coverage_xml is True
    assert new_args.coverage_html is True
예제 #10
0
def test_project_without_args(tmpfolder):
    old_args = ["my_project", "-u", "http://www.blue-yonder.com/",
                "-d", "my description"]
    cli.main(old_args)
    args = ["my_project"]
    opts = cli.parse_args(args)
    new_opts = info.project(opts)
    assert new_opts['url'] == "http://www.blue-yonder.com/"
    assert new_opts['package'] == "my_project"
    assert new_opts['license'] == "mit"
    assert new_opts['description'] == "my description"
예제 #11
0
def test_project_with_args(tmpdir):  # noqa
    old_args = ["my_project", "-u", "http://www.blue-yonder.com/",
                "-d", "my description"]
    cli.main(old_args)
    args = ["my_project", "-u", "http://www.google.com/",
            "-d", "other description"]
    opts = cli.parse_args(args)
    new_opts = info.project(opts)
    assert new_opts['url'] == "http://www.blue-yonder.com/"
    assert new_opts['package'] == "my_project"
    assert new_opts['description'] == "my description"
예제 #12
0
def test_save_action(default_file):
    # When the file does not exist
    assert not default_file.exists()
    opts = dict(author="author", email="email", license="MPL-2.0")
    config.save({}, {**opts, "save_config": default_file})
    # it will create a valid file from the point of view of parsing
    assert default_file.exists()
    parsed = info.project({}, default_file)
    assert all(parsed[k] == v for k, v in opts.items())
    # and the file will contain instructions / references
    assert "pyscaffold.org" in default_file.read_text()
예제 #13
0
def test_project_with_args(tmpdir):  # noqa
    old_args = ["my_project", "-u", "http://www.blue-yonder.com/",
                "-d", "my description"]
    cli.main(old_args)
    args = ["my_project", "-u", "http://www.google.com/",
            "-d", "other description"]
    opts = cli.parse_args(args)
    new_opts = info.project(opts)
    assert new_opts['url'] == "http://www.blue-yonder.com/"
    assert new_opts['package'] == "my_project"
    assert new_opts['description'] == "my description"
예제 #14
0
def test_project_without_args(tmpdir):  # noqa
    old_args = ["my_project", "-u", "http://www.blue-yonder.com/",
                "-d", "my description"]
    runner.main(old_args)
    args = ["my_project"]
    args = runner.parse_args(args)
    new_args = info.project(args)
    assert new_args.url == "http://www.blue-yonder.com/"
    assert new_args.package == "my_project"
    assert new_args.license == "none"
    assert new_args.description == "my description"
예제 #15
0
def test_project_with_junit_coverage_args_overwritten(tmpdir):
    old_args = ["my_project"]
    runner.main(old_args)
    args = [
        "my_project", "--with-junit-xml", "--with-coverage-xml",
        "--with-coverage-html"
    ]
    args = runner.parse_args(args)
    new_args = info.project(args)
    assert new_args.junit_xml is True
    assert new_args.coverage_xml is True
    assert new_args.coverage_html is True
예제 #16
0
def test_project_with_args(tmpdir):
    old_args = ["my_project", "-u", "http://www.blue-yonder.com/",
                "-d", "my description"]
    runner.main(old_args)
    args = ["my_project", "-u", "http://www.google.com/",
            "-d", "other description", "-l", "new-bsd"]
    args = runner.parse_args(args)
    new_args = info.project(args)
    assert new_args.url == "http://www.google.com/"
    assert new_args.package == "my_project"
    assert new_args.license == "new BSD"
    assert new_args.description == "other description"
예제 #17
0
def test_project_without_args(tmpdir):  # noqa
    old_args = [
        "my_project", "-u", "http://www.blue-yonder.com/", "-d",
        "my description"
    ]
    runner.main(old_args)
    args = ["my_project"]
    args = runner.parse_args(args)
    new_args = info.project(args)
    assert new_args.url == "http://www.blue-yonder.com/"
    assert new_args.package == "my_project"
    assert new_args.license == "none"
    assert new_args.description == "my description"
예제 #18
0
def test_project_without_args(tmpdir):
    old_args = ["my_project", "-u", "http://www.blue-yonder.com/",
                "-d", "my description"]
    runner.main(old_args)
    args = ["my_project"]
    args = runner.parse_args(args)
    new_args = info.project(args)
    assert new_args.url == "http://www.blue-yonder.com/"
    assert new_args.package == "my_project"
    assert new_args.license == "new BSD"
    assert new_args.description == "my description"
    assert new_args.junit_xml is False
    assert new_args.coverage_xml is False
    assert new_args.coverage_html is False
예제 #19
0
def test_save_action_existing_file(default_file, monkeypatch):
    # Given default values that differ a bit from the given opts
    monkeypatch.setattr(info, "username", lambda *_: "John Doe")
    monkeypatch.setattr(info, "email", lambda *_: "email")
    monkeypatch.setitem(api.DEFAULT_OPTIONS, "license", "MPL-2.0")
    opts = dict(author="author", email="email", license="MPL-2.0")
    # When the file exists and new config is saved
    existing_config(default_file)
    config.save({}, {**opts, "save_config": default_file})
    # Then metadata that differs from default will change
    expected = dict(author="author",
                    email="*****@*****.**",
                    license="GPL-3.0-only")
    parsed = info.project({}, default_file)
    assert all(parsed[k] == v for k, v in expected.items())
예제 #20
0
def test_project_with_args(tmpdir):
    old_args = [
        "my_project", "-u", "http://www.blue-yonder.com/", "-d",
        "my description"
    ]
    runner.main(old_args)
    args = [
        "my_project", "-u", "http://www.google.com/", "-d",
        "other description", "-l", "new-bsd"
    ]
    args = runner.parse_args(args)
    new_args = info.project(args)
    assert new_args.url == "http://www.google.com/"
    assert new_args.package == "my_project"
    assert new_args.license == "new BSD"
    assert new_args.description == "other description"
예제 #21
0
def test_project_without_args(tmpfolder):
    old_args = [
        "my_project",
        "-u",
        "http://www.blue-yonder.com/",
        "-d",
        "my description",
    ]
    cli.main(old_args)
    args = ["my_project"]
    opts = cli.parse_args(args)
    new_opts = info.project(opts)
    assert new_opts["url"] == "http://www.blue-yonder.com/"
    assert new_opts["package"] == "my_project"
    assert new_opts["license"] == "MIT"
    assert new_opts["description"] == "my description"
예제 #22
0
def test_project_without_args(tmpdir):
    old_args = [
        "my_project", "-u", "http://www.blue-yonder.com/", "-d",
        "my description"
    ]
    runner.main(old_args)
    args = ["my_project"]
    args = runner.parse_args(args)
    new_args = info.project(args)
    assert new_args.url == "http://www.blue-yonder.com/"
    assert new_args.package == "my_project"
    assert new_args.license == "new BSD"
    assert new_args.description == "my description"
    assert new_args.junit_xml is False
    assert new_args.coverage_xml is False
    assert new_args.coverage_html is False
예제 #23
0
def test_project_with_args(tmpfolder):
    old_args = [
        "my_project",
        "-u",
        "http://www.blue-yonder.com/",
        "-d",
        "my description",
    ]
    cli.main(old_args)
    args = [
        "my_project", "-u", "http://www.google.com/", "-d", "other description"
    ]
    opts = cli.parse_args(args)
    opts = cli.process_opts(opts)
    new_opts = info.project(opts)
    assert new_opts["url"] == "http://www.google.com/"
    assert new_opts["package"] == "my_project"
    assert new_opts["description"] == "other description"
예제 #24
0
def test_project_with_no_setup(tmpdir):  # noqa
    os.mkdir("my_project")
    args = ["my_project"]
    args = cli.parse_args(args)
    with pytest.raises(RuntimeError):
        info.project(args)
예제 #25
0
def test_project_raises():
    args = type("Namespace", (object, ), {"project": "non_existant"})
    with pytest.raises(RuntimeError):
        info.project(args)
예제 #26
0
def test_project_raises():
    opts = {"project": "non_existant"}
    with pytest.raises(RuntimeError):
        info.project(opts)
예제 #27
0
def test_project_old_setupcfg(tmpfolder):
    demoapp = Path(__file__).parent / "demoapp"
    with pytest.raises(exceptions.PyScaffoldTooOld):
        info.project({}, config_path=demoapp)
예제 #28
0
def test_project_raises():
    opts = {"project": "non_existant"}
    with pytest.raises(RuntimeError):
        info.project(opts)
예제 #29
0
def test_project_with_no_setup(tmpdir):  # noqa
    os.mkdir("my_project")
    args = ["my_project"]
    args = cli.parse_args(args)
    with pytest.raises(RuntimeError):
        info.project(args)
예제 #30
0
def test_project_raises():
    args = type("Namespace", (object,), {"project": "non_existant"})
    with pytest.raises(RuntimeError):
        info.project(args)