Skip to content

Commit

Permalink
Speed up tests
Browse files Browse the repository at this point in the history
Use libgit2/TestGitRepository instead of libgit2/pygit2, in submodule
tests.
  • Loading branch information
jdavid committed Apr 19, 2020
1 parent cb20c8d commit 3e5e995
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/dist/
/docs/_build/
/MANIFEST
/venv*
__pycache__/
*.egg-info
*.pyc
Expand Down
Binary file modified test/data/submodulerepo.tar
Binary file not shown.
18 changes: 9 additions & 9 deletions test/test_submodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
from . import utils


SUBM_NAME = 'submodule'
SUBM_PATH = 'submodule'
SUBM_URL = 'https://github.com/libgit2/pygit2'
SUBM_HEAD_SHA = '819cbff552e46ac4b8d10925cc422a30aa04e78e'
SUBM_NAME = 'TestGitRepository'
SUBM_PATH = 'TestGitRepository'
SUBM_URL = 'https://github.com/libgit2/TestGitRepository'
SUBM_HEAD_SHA = '49322bb17d3acc9146f98c97d078513228bbf3c0'


class SubmoduleTest(utils.SubmoduleRepoTestCase):
Expand Down Expand Up @@ -77,23 +77,23 @@ def test_url(self):

@unittest.skipIf(utils.no_network(), "Requires network")
def test_init_and_update(self):
subrepo_file_path = os.path.join(self.repo_path, 'submodule', 'setup.py')
subrepo_file_path = os.path.join(self.repo_path, 'TestGitRepository', 'master.txt')
assert not os.path.exists(subrepo_file_path)
self.repo.init_submodules()
self.repo.update_submodules()
assert os.path.exists(subrepo_file_path)

@unittest.skipIf(utils.no_network(), "Requires network")
def test_specified_update(self):
subrepo_file_path = os.path.join(self.repo_path, 'submodule', 'setup.py')
subrepo_file_path = os.path.join(self.repo_path, 'TestGitRepository', 'master.txt')
assert not os.path.exists(subrepo_file_path)
self.repo.init_submodules(submodules=['submodule'])
self.repo.update_submodules(submodules=['submodule'])
self.repo.init_submodules(submodules=['TestGitRepository'])
self.repo.update_submodules(submodules=['TestGitRepository'])
assert os.path.exists(subrepo_file_path)

@unittest.skipIf(utils.no_network(), "Requires network")
def test_oneshot_update(self):
subrepo_file_path = os.path.join(self.repo_path, 'submodule', 'setup.py')
subrepo_file_path = os.path.join(self.repo_path, 'TestGitRepository', 'master.txt')
assert not os.path.exists(subrepo_file_path)
self.repo.update_submodules(init=True)
assert os.path.exists(subrepo_file_path)
Expand Down

0 comments on commit 3e5e995

Please sign in to comment.