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_update_and_check_real_repo(tmpdir):
tmpdir.chdir()
repo = Repo.clone_from("https://github.com/timothycrosley/cruft", str(tmpdir))
repo.head.reset(commit="86a6e6beda8095690414ff7652c15b7ae36e6128", working_tree=True)
with open(os.path.join(tmpdir, ".cruft.json")) as cruft_file:
cruft = json.load(cruft_file)
cruft["skip"] = ["cruft/__init__.py", "tests"]
with open(os.path.join(tmpdir, ".cruft.json"), "w") as cruft_file:
json.dump(cruft, cruft_file)
repo_dir = str(tmpdir)
assert not api.check(repo_dir)
assert api.update(repo_dir, skip_apply_ask=True)
def test_check_examples(project_dir):
with pytest.raises(exceptions.NoCruftFound):
verify_and_test_examples(api.check)
os.chdir(project_dir)
verify_and_test_examples(api.check)
print("Good work! Project's cruft has been updated and is as clean as possible!")
def _link_output(linked: bool) -> None:
if linked:
print("")
print("Project successfully linked to template!")
else:
print("")
print("Project linking failed :(")
cli = hug.cli(api=hug_api)
cli(api.create)
cli.output(_update_output)(api.update)
cli.output(_check_command_output)(api.check)
cli.output(_link_output)(api.link)