diff options
author | Santos Gallegos <santos_g@outlook.com> | 2018-12-23 21:25:05 -0500 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2019-07-20 19:48:09 +0800 |
commit | 21b176732ba16379d57f53e956456bc2c5970baf (patch) | |
tree | 28a75e3ea463c1383c8cce481b0ca5b9173093a2 /git/test/test_submodule.py | |
parent | a02facd0b4f9c2d2c039f0d7dc5af8354ce0201b (diff) | |
download | gitpython-21b176732ba16379d57f53e956456bc2c5970baf.tar.gz |
Add test
Diffstat (limited to 'git/test/test_submodule.py')
-rw-r--r-- | git/test/test_submodule.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/git/test/test_submodule.py b/git/test/test_submodule.py index 0bf76380..2703ad6f 100644 --- a/git/test/test_submodule.py +++ b/git/test/test_submodule.py @@ -2,6 +2,7 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php import os +import shutil import sys from unittest import skipIf @@ -660,6 +661,24 @@ class TestSubmodule(TestBase): url=empty_repo_dir, no_checkout=checkout_mode and True or False) # end for each checkout mode + @with_rw_directory + def test_list_only_valid_submodules(self, rwdir): + repo_path = osp.join(rwdir, 'parent') + repo = git.Repo.init(repo_path) + repo.git.submodule('add', self._small_repo_url(), 'module') + repo.index.commit("add submodule") + + assert len(repo.submodules) == 1 + + # Delete the directory from submodule + submodule_path = osp.join(repo_path, 'module') + shutil.rmtree(submodule_path) + repo.git.add([submodule_path]) + repo.index.commit("remove submodule") + + repo = git.Repo(repo_path) + assert len(repo.submodules) == 0 + @skipIf(HIDE_WINDOWS_KNOWN_ERRORS, """FIXME on cygwin: File "C:\\projects\\gitpython\\git\\cmd.py", line 671, in execute raise GitCommandError(command, status, stderr_value, stdout_value) |