Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add test
  • Loading branch information
stsewd committed Jun 25, 2019
commit 0e577f5066deafe024d109904d34956566d49f89
19 changes: 19 additions & 0 deletions git/test/test_submodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -660,6 +661,24 @@ def test_add_empty_repo(self, rwdir):
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)
Expand Down