def test_has_git_stash(tmpdir): tmpdir.chdir() tmpdir.mkdir("hello_world") subprocess.call(["git", "init"], cwd="hello_world") q = GitProject("hello_world") subprocess.call(["git", "config", "user.email", '"*****@*****.**"'], cwd="hello_world") subprocess.call(["git", "config", "user.name", '"My Name"'], cwd="hello_world") assert q.has_git_stash() is False success = q.check_git_stash()[0] assert success with open("hello_world/README", "w") as f: f.write("foobar") with open("hello_world/FROBNITZ", "w") as f: f.write("Man, Zork was awesome.") subprocess.call(["git", "add", "README", "FROBNITZ"], cwd="hello_world") subprocess.call(["git", "commit", "-m", "Initial commit."], cwd="hello_world") assert q.has_git_stash() is False success = q.check_git_stash()[0] assert success with open("hello_world/README", "a") as f: f.write("woooooo") subprocess.call(["git", "stash"], cwd="hello_world") assert q.has_git_stash() is True success = q.check_git_stash()[0] assert not success with open("hello_world/FROBNITZ", "w") as f: f.write("Someday, I'll be an Implementor.") subprocess.call(["git", "stash"], cwd="hello_world") assert q.has_git_stash() is True success = q.check_git_stash()[0] assert not success