How to use the pyscaffold.cli.main function in PyScaffold

To help you get started, we’ve selected a few PyScaffold examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pyscaffold / pyscaffold / tests / test_install.py View on Github external
def _generate(self):
        putup([self.name])
        with chdir(self.name):
            demoapp_src_dir = path_join(__location__, self.name)
            demoapp_dst_root = self.pkg_path
            demoapp_dst_pkg = path_join(demoapp_dst_root, "src", self.name)
            copyfile(
                path_join(demoapp_src_dir, "runner.py"),
                path_join(demoapp_dst_pkg, "runner.py"),
            )
            git("add", path_join(demoapp_dst_pkg, "runner.py"))
            copyfile(
                path_join(demoapp_src_dir, "setup.cfg"),
                path_join(demoapp_dst_root, "setup.cfg"),
            )
            copyfile(
                path_join(demoapp_src_dir, "setup.py"),
                path_join(demoapp_dst_root, "setup.py"),
github pyscaffold / pyscaffold / tests / test_info.py View on Github external
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)
    opts = cli.process_opts(opts)
    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"
github pyscaffold / pyscaffold / tests / test_cli.py View on Github external
def test_main_with_old_setuptools(old_setuptools_mock):
    args = ["my-project"]
    with pytest.raises(OldSetuptools):
        cli.main(args)
github pyscaffold / pyscaffold / tests / test_info.py View on Github external
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"
github pyscaffold / pyscaffold / tests / test_cli.py View on Github external
def test_main_when_updating(tmpfolder, capsys, git_mock):
    args = ["my-project"]
    cli.main(args)
    args = ["--update", "my-project"]
    cli.main(args)
    assert os.path.exists(args[1])
    out, _ = capsys.readouterr()
    assert "Update accomplished!" in out
github pyscaffold / pyscaffold / tests / test_cli.py View on Github external
def test_pretend_main(tmpfolder, git_mock, caplog):
    for flag in ["--pretend", "-P"]:
        args = ["my-project", flag]
        cli.main(args)
        assert not os.path.exists(args[0])

        # Check for some log messages
        assert find_report(caplog, "invoke", "get_default_options")
        assert find_report(caplog, "invoke", "verify_options_consistency")
        assert find_report(caplog, "invoke", "define_structure")
        assert find_report(caplog, "invoke", "create_structure")
        assert find_report(caplog, "create", "setup.py")
        assert find_report(caplog, "create", "requirements.txt")
        assert find_report(caplog, "create", lp("my_project/__init__.py"))
        assert find_report(caplog, "run", "git init")
        assert find_report(caplog, "run", "git add")
github pyscaffold / pyscaffold / tests / test_cli.py View on Github external
def test_verbose_main(tmpfolder, git_mock, caplog):
    args = ["my-project", "--verbose"]
    cli.main(args)
    assert os.path.exists(args[0])

    # Check for some log messages
    assert find_report(caplog, "invoke", "get_default_options")
    assert find_report(caplog, "invoke", "verify_options_consistency")
    assert find_report(caplog, "invoke", "define_structure")
    assert find_report(caplog, "invoke", "create_structure")
    assert find_report(caplog, "create", "setup.py")
    assert find_report(caplog, "create", "requirements.txt")
    assert find_report(caplog, "create", lp("my_project/__init__.py"))
    assert find_report(caplog, "run", "git init")
    assert find_report(caplog, "run", "git add")
github pyscaffold / pyscaffold / tests / test_cli.py View on Github external
def test_main_with_list_actions(capsys, isolated_logger):
    # When putup is called with --list-actions,
    args = ["my-project", "--tox", "--list-actions"]
    cli.main(args)
    # then the action list should be printed,
    out, _ = capsys.readouterr()
    assert "Planned Actions" in out
    assert "pyscaffold.api:get_default_options" in out
    assert "pyscaffold.structure:define_structure" in out
    assert "pyscaffold.extensions.tox:add_files" in out
    assert "pyscaffold.structure:create_structure" in out
    assert "pyscaffold.api:init_git" in out
    # but no project should be created
    assert not os.path.exists(args[0])