Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_cli_without_travis(tmpfolder):
# Given the command line without the travis option,
sys.argv = ["pyscaffold", "proj"]
# when pyscaffold runs,
run()
# then travis files should not exist
assert not path_exists("proj/.travis.yml")
assert not path_exists("proj/tests/travis_install.sh")
def test_cli_with_cirrus(tmpfolder):
# Given the command line with the cirrus option,
sys.argv = ["pyscaffold", "--cirrus", "proj"]
# when pyscaffold runs,
run()
# then files from cirrus and other extensions automatically added should
# exist
assert path_exists("proj/.cirrus.yml")
assert path_exists("proj/tox.ini")
assert path_exists("proj/.pre-commit-config.yaml")
def test_cli_without_no_skeleton(tmpfolder):
# Given the command line without the tox option,
sys.argv = ["pyscaffold", "proj"]
# when pyscaffold runs,
run()
# then skeleton file should exist
assert path_exists("proj/src/proj/skeleton.py")
assert path_exists("proj/tests/test_skeleton.py")
def test_cli_with_travis(tmpfolder):
# Given the command line with the travis option,
sys.argv = ["pyscaffold", "--travis", "proj"]
# when pyscaffold runs,
run()
# then travis files should exist
assert path_exists("proj/.travis.yml")
assert path_exists("proj/tests/travis_install.sh")
def test_cli_without_namespace(tmpfolder):
# Given the command line without the namespace option,
sys.argv = ["pyscaffold", "proj"]
# when pyscaffold runs,
run()
# then namespace files should not exist
assert not path_exists("proj/src/ns/__init__.py")
def test_cli_with_django_and_update(tmpfolder, capsys):
# Given a project exists
create_project(project=PROJ_NAME)
# when the project is updated
# with the django extension,
sys.argv = ["pyscaffold", PROJ_NAME, "--update", "--django"]
run()
# 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")
)
def test_cli_with_no_skeleton(tmpfolder):
# Given the command line with the tox option,
sys.argv = ["pyscaffold", "--no-skeleton", "proj"]
# when pyscaffold runs,
run()
# then skeleton file should not exist
assert not path_exists("proj/src/proj/skeleton.py")
assert not path_exists("proj/tests/test_skeleton.py")
def test_cli_without_cirrus(tmpfolder):
# Given the command line without the cirrus option,
sys.argv = ["pyscaffold", "proj"]
# when pyscaffold runs,
run()
# then cirrus files should not exist
assert not path_exists("proj/.cirrus.yml")
def test_run(tmpfolder, git_mock):
sys.argv = ["pyscaffold", "my-project"]
cli.run()
assert os.path.exists(sys.argv[1])
def test_cli_with_cookiecutter(tmpfolder):
# Given the command line with the cookiecutter option,
sys.argv = ["pyscaffold", PROJ_NAME, "--cookiecutter", COOKIECUTTER_URL]
# when pyscaffold runs,
run()
# then cookiecutter files should exist
for path in COOKIECUTTER_FILES:
assert path_exists(path)