diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2009-10-16 13:05:01 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2009-10-16 13:05:01 +0200 |
commit | 919164df96d9f956c8be712f33a9a037b097745b (patch) | |
tree | 92258654fb1e137d8b5234174ef10d9dd7c83cdc /test/git/test_repo.py | |
parent | f2df1f56cccab13d5c92abbc6b18be725e7b4833 (diff) | |
download | gitpython-919164df96d9f956c8be712f33a9a037b097745b.tar.gz |
repo.untracked_files added including test
Diffstat (limited to 'test/git/test_repo.py')
-rw-r--r-- | test/git/test_repo.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/git/test_repo.py b/test/git/test_repo.py index 96d08b91..250974a5 100644 --- a/test/git/test_repo.py +++ b/test/git/test_repo.py @@ -225,3 +225,28 @@ class TestRepo(object): assert_true( tlist ) assert_true( isinstance( tlist[0], basestring ) ) assert_true( len( tlist ) < sum( len(t) for t in tlist ) ) # test for single-char bug + + def test_untracked_files(self): + base = self.repo.git.git_dir + files = (base+"/__test_myfile", base+"/__test_other_file") + num_recently_untracked = 0 + try: + for fpath in files: + fd = open(fpath,"wb") + fd.close() + # END for each filename + untracked_files = self.repo.untracked_files + num_recently_untracked = len(untracked_files) + + # assure we have all names - they are relative to the git-dir + num_test_untracked = 0 + for utfile in untracked_files: + num_test_untracked += os.path.join(base, utfile) in files + assert len(files) == num_test_untracked + finally: + for fpath in files: + if os.path.isfile(fpath): + os.remove(fpath) + # END handle files + + assert len(self.repo.untracked_files) == (num_recently_untracked - len(files)) |