Skip to content

Commit 68a0331

Browse files
authored
Merge pull request #1204 from minrk/submodule-https
run submodule test over https
2 parents e0d5b9b + e9ad8fd commit 68a0331

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

tests/conftest.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def repo_with_content(git_repo):
121121
yield git_repo, sha1
122122

123123

124-
@pytest.fixture()
124+
@pytest.fixture
125125
def repo_with_submodule():
126126
"""Create a git repository with a git submodule in a non-master branch.
127127
@@ -134,15 +134,13 @@ def repo_with_submodule():
134134
the submodule yet.
135135
136136
"""
137-
with TemporaryDirectory() as git_a_dir, TemporaryDirectory() as git_b_dir:
137+
submodule_repo = "https://github.com/binderhub-ci-repos/requirements"
138+
submod_sha1_b = "20c4fe55a9b2c5011d228545e821b1c7b1723652"
139+
140+
with TemporaryDirectory() as git_a_dir:
138141
# create "parent" repository
139142
subprocess.check_call(["git", "init"], cwd=git_a_dir)
140143
_add_content_to_git(git_a_dir)
141-
# create repository with 2 commits that will be the submodule
142-
subprocess.check_call(["git", "init"], cwd=git_b_dir)
143-
_add_content_to_git(git_b_dir)
144-
submod_sha1_b = _get_sha1(git_b_dir)
145-
_add_content_to_git(git_b_dir)
146144

147145
# create a new branch in the parent without any submodule
148146
subprocess.check_call(
@@ -153,7 +151,14 @@ def repo_with_submodule():
153151
["git", "checkout", "-b", "branch-with-submod"], cwd=git_a_dir
154152
)
155153
subprocess.check_call(
156-
["git", "submodule", "add", git_b_dir, "submod"], cwd=git_a_dir
154+
[
155+
"git",
156+
"submodule",
157+
"add",
158+
submodule_repo,
159+
"submod",
160+
],
161+
cwd=git_a_dir,
157162
)
158163
# checkout the first commit for the submod, not the latest
159164
subprocess.check_call(

tests/unit/contentproviders/test_git.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_submodule_clone(repo_with_submodule):
3333
pass
3434

3535
assert os.path.exists(os.path.join(clone_dir2, "test"))
36-
assert not os.path.exists(os.path.join(submod_dir, "test"))
36+
assert not os.path.exists(os.path.join(submod_dir, "requirements.txt"))
3737

3838
with TemporaryDirectory() as clone_dir:
3939
submod_dir = os.path.join(clone_dir, "submod") # set by fixture
@@ -42,7 +42,7 @@ def test_submodule_clone(repo_with_submodule):
4242
for _ in git_content.fetch(spec, clone_dir):
4343
pass
4444
assert os.path.exists(os.path.join(clone_dir, "test"))
45-
assert os.path.exists(os.path.join(submod_dir, "test"))
45+
assert os.path.exists(os.path.join(submod_dir, "requirements.txt"))
4646

4747
# get current sha1 of submodule
4848
cmd = ["git", "rev-parse", "HEAD"]

0 commit comments

Comments
 (0)