def quickstart(tempdir): """ $ cd tempdir $ ballet quickstart $ tree . """ # cd tempdir with work_in(safepath(tempdir)): project_slug = 'foo-bar' package_slug = 'foo_bar' extra_context = { 'project_name': project_slug.capitalize(), 'project_slug': project_slug, 'package_slug': package_slug, } # ballet quickstart render_project_template(no_input=True, extra_context=extra_context, output_dir=safepath(tempdir)) # tree . tree(tempdir) project = Project.from_path(tempdir.joinpath(project_slug)) repo = project.repo yield (namedtuple( 'Quickstart', 'project tempdir project_slug package_slug repo')._make( (project, tempdir, project_slug, package_slug, repo)))
def test_render_project_template_create_remote( mock_cookiecutter, mock_from_path, mock_create_github_repo, mock_push_branches_to_remote, ): render_project_template(create_github_repo=True, github_token='token') mock_create_github_repo.assert_called_once() mock_push_branches_to_remote.assert_called_once()
def quickstart(tempdir): """ $ cd tempdir $ ballet quickstart $ tree . """ # cd tempdir with work_in(tempdir): project_slug = 'foo-bar' package_slug = 'foo_bar' extra_context = { 'project_name': project_slug.capitalize(), 'project_slug': project_slug, 'package_slug': package_slug, } # ballet quickstart render_project_template(no_input=True, extra_context=extra_context, output_dir=tempdir) # tree . tree(tempdir) project = Project.from_path(tempdir.joinpath(project_slug)) repo = project.repo yield QuickstartResult(project, tempdir, project_slug, package_slug, repo)
def test_render_project_template(self, mock_cookiecutter): render_project_template() args, _ = mock_cookiecutter.call_args self.assertEqual(len(args), 1) path = args[0] self.assertIn('project_template', str(path))
def test_render_project_template(mock_cookiecutter): render_project_template() args, _ = mock_cookiecutter.call_args assert len(args) == 1 path = args[0] assert 'project_template' in str(path)
def _render_project_template(cwd, tempdir, project_template_path=None): tempdir = pathlib.Path(tempdir) context = _get_full_context(cwd) # don't dump replay files to home directory. with patch('cookiecutter.main.dump'): return render_project_template( project_template_path=project_template_path, no_input=True, extra_context=context, output_dir=safepath(tempdir))