-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac3e6dd
commit 96ac371
Showing
6 changed files
with
93 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import pytest | ||
from pathlib import Path | ||
|
||
def test_basic_checkout(git_fleximod, test_repo): | ||
# Prepare a simple .gitmodules | ||
|
||
gitmodules_content = """ | ||
[submodule "test_submodule"] | ||
path = modules/test | ||
url = https://github.com/ESMCI/mpi-serial.git | ||
fxtag = MPIserial_2.4.0 | ||
fxurl = https://github.com/ESMCI/mpi-serial.git | ||
fxrequired = T:T | ||
""" | ||
(test_repo / ".gitmodules").write_text(gitmodules_content) | ||
|
||
# Run the command | ||
result = git_fleximod("checkout") | ||
|
||
# Assertions | ||
assert result.returncode == 0 | ||
assert Path(test_repo / "modules/test").exists() # Did the submodule directory get created? | ||
|
||
status = git_fleximod("status") | ||
|
||
assert "test_submodule d82ce7c is out of sync with .gitmodules MPIserial_2.4.0" in status.stdout | ||
|
||
result = git_fleximod("update") | ||
assert result.returncode == 0 | ||
|
||
status = git_fleximod("status") | ||
assert "test_submodule at tag MPIserial_2.4.0" in status.stdout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import pytest | ||
from shutil import rmtree | ||
from pathlib import Path | ||
from git_fleximod.gitinterface import GitInterface | ||
|
||
def test_sparse_checkout(git_fleximod, test_repo_base): | ||
# Prepare a simple .gitmodules | ||
gitmodules_content = (test_repo_base / ".gitmodules").read_text() + """ | ||
[submodule "test_sparse_submodule"] | ||
path = modules/sparse_test | ||
url = https://github.com/ESMCI/mpi-serial.git | ||
fxtag = MPIserial_2.5.0 | ||
fxurl = https://github.com/ESMCI/mpi-serial.git | ||
fxsparse = ../.sparse_file_list | ||
""" | ||
(test_repo_base / ".gitmodules").write_text(gitmodules_content) | ||
|
||
# Add the sparse checkout file | ||
sparse_content = """m4 | ||
""" | ||
(test_repo_base / "modules" / ".sparse_file_list").write_text(sparse_content) | ||
|
||
result = git_fleximod("checkout") | ||
|
||
# Assertions | ||
assert result.returncode == 0 | ||
assert Path(test_repo_base / "modules/sparse_test").exists() # Did the submodule directory get created? | ||
assert Path(test_repo_base / "modules/sparse_test/m4").exists() # Did the submodule sparse directory get created? | ||
assert not Path(test_repo_base / "modules/sparse_test/README").exists() # Did only the submodule sparse directory get created? | ||
status = git_fleximod("status test_sparse_submodule") | ||
|
||
assert "test_sparse_submodule at tag MPIserial_2.5.0" in status.stdout | ||
|
||
result = git_fleximod("update") | ||
assert result.returncode == 0 | ||
|
||
status = git_fleximod("status test_sparse_submodule") | ||
assert "test_sparse_submodule at tag MPIserial_2.5.0" in status.stdout |