diff options
author | Axel Aguado <axelaguado@gmail.com> | 2023-01-21 14:06:25 -0600 |
---|---|---|
committer | Axel Aguado <axelaguado@gmail.com> | 2023-01-21 15:32:03 -0600 |
commit | 7ada83a4cf83c1178159c250a11811012506058c (patch) | |
tree | 823d1e73c30ad5eb36130eb730b1a64782d44fa1 | |
parent | f594266acf09896608234947611fb3af356130dd (diff) | |
download | gitpython-7ada83a4cf83c1178159c250a11811012506058c.tar.gz |
Add test_ignored_items_reported
-rw-r--r-- | test/test_repo.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/test_repo.py b/test/test_repo.py index d5474353..c21f3270 100644 --- a/test/test_repo.py +++ b/test/test_repo.py @@ -1384,3 +1384,19 @@ class TestRepo(TestBase): rw_repo.clone_from(payload, temp_repo.common_dir) assert not unexpected_file.exists() + + def test_ignored_items_reported(self): + with tempfile.TemporaryDirectory() as tdir: + tmp_dir = pathlib.Path(tdir) + temp_repo = Repo.init(tmp_dir / "repo") + + gi = tmp_dir / "repo" / ".gitignore" + + with open(gi, 'w') as file: + file.write('ignored_file.txt\n') + file.write('ignored_dir/\n') + + assert temp_repo.ignored(['included_file.txt', 'included_dir/file.txt']) == [] + assert temp_repo.ignored(['ignored_file.txt']) == ['ignored_file.txt'] + assert temp_repo.ignored(['included_file.txt', 'ignored_file.txt']) == ['ignored_file.txt'] + assert temp_repo.ignored(['included_file.txt', 'ignored_file.txt', 'included_dir/file.txt', 'ignored_dir/file.txt']) == ['ignored_file.txt', 'ignored_dir/file.txt']
\ No newline at end of file |