def test_untracked_files(tmpdir): tmpdir.chdir() tmpdir.mkdir("hello_world") subprocess.call(["git", "init"], cwd="hello_world") subprocess.call(["git", "config", "user.email", '"*****@*****.**"'], cwd="hello_world") subprocess.call(["git", "config", "user.name", '"My Name"'], cwd="hello_world") q = GitProject("hello_world") with open("hello_world/committed", "w") as f: f.write("foobar") subprocess.call(["git", "add", "committed"], cwd="hello_world") subprocess.call(["git", "commit", "-m", "Initial commit."], cwd="hello_world") assert len(q.get_uncommitted_changes()) == 0 success = q.check_uncommitted_changes()[0] assert success with open("hello_world/untracked1", "a") as f: f.write("woooooo") with open("hello_world/untracked2", "a") as f: f.write("woooooo") assert len(q.get_uncommitted_changes()) == 2 assert b"untracked1" in q.get_uncommitted_changes() assert b"untracked2" in q.get_uncommitted_changes() success = q.check_uncommitted_changes()[0] assert not success