def test_create_project_with_cookiecutter_but_no_template(tmpfolder): # Given options with the cookiecutter extension, but no template opts = dict(project=PROJ_NAME, extensions=[cookiecutter.Cookiecutter('cookiecutter')]) # when the project is created, # then an exception should be raised. with pytest.raises(cookiecutter.MissingTemplate): create_project(opts)
def test_create_project_no_cookiecutter(tmpfolder, nocookiecutter_mock): # Given options with the cookiecutter extension, # but without cookiecutter being installed, opts = dict(project=PROJ_NAME, cookiecutter=COOKIECUTTER_URL, extensions=[cookiecutter.Cookiecutter('cookiecutter')]) # when the project is created, # then an exception should be raised. with pytest.raises(cookiecutter.NotInstalled): create_project(opts)
def test_create_project_cookiecutter_and_update(tmpfolder): # Given a project exists create_project(project=PROJ_NAME) # when the project is updated # with the cookiecutter extension, opts = dict(project=PROJ_NAME, update=True, cookiecutter=COOKIECUTTER_URL, extensions=[cookiecutter.Cookiecutter('cookiecutter')]) # then an exception should be raised. with pytest.raises(cookiecutter.UpdateNotSupported): create_project(opts)
def test_create_project_with_cookiecutter(tmpfolder): # Given options with the cookiecutter extension, opts = dict(project=PROJ_NAME, cookiecutter=COOKIECUTTER_URL, extensions=[cookiecutter.Cookiecutter('cookiecutter')]) # when the project is created, create_project(opts) # then cookiecutter files should exist for path in COOKIECUTTER_FILES: assert path_exists(path) # and also overwritable pyscaffold files (with the exact contents) tmpfolder.join(PROJ_NAME).join("setup.py").read() == setup_py(opts)
def test_create_project_cookiecutter_and_update(tmpfolder, capsys): # Given a project exists create_project(project=PROJ_NAME) # when the project is updated # with the cookiecutter extension, opts = dict(project=PROJ_NAME, update=True, cookiecutter=COOKIECUTTER_URL, extensions=[cookiecutter.Cookiecutter('cookiecutter')]) create_project(opts) # then a warning should be displayed out, err = capsys.readouterr() assert all(warn in out + err for warn in ('external tools', 'not supported', 'will be ignored'))