Skip to content

Commit

Permalink
test: integration test for git
Browse files Browse the repository at this point in the history
  • Loading branch information
fblanchetNaN committed Jul 2, 2022
1 parent af5ca27 commit 718ce55
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
Binary file added tests/test_tools/git.tar.gz
Binary file not shown.
34 changes: 34 additions & 0 deletions tests/test_tools/test_git.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import filecmp
import os
import pathlib
import shutil

from tests.test_tools import testing

from incipyt import __main__


def make_archive():
runner = testing.IncipytRunner()
root_dir = pathlib.Path(__file__).parent
with runner.isolated_filesystem() as td:
runner.invoke(__main__.main, ["--vcs=git", "--check-build", "my_project"])
os.chdir(root_dir)
os.remove("git.tar.gz")
shutil.make_archive("git", "gztar", root_dir=td, base_dir="my_project")


def test_integration(tmp_path):
runner = testing.IncipytRunner(input_mapping={r"Repository": ""})
with runner.isolated_filesystem(temp_dir=tmp_path):
result = runner.invoke(
__main__.main, ["--vcs=git", "--check-build", "my_project"]
)
shutil.unpack_archive(pathlib.Path(__file__).parent / "git.tar.gz", "archive")
diff = testing.diff_files(
filecmp.dircmp("my_project", pathlib.Path("archive/my_project"))
)

assert diff == set()
assert not result.exception
assert result.exit_code == 0

0 comments on commit 718ce55

Please sign in to comment.