Skip to content

Commit

Permalink
Add debug for ci
Browse files Browse the repository at this point in the history
  • Loading branch information
minitriga committed Jan 9, 2025
1 parent bd91c6e commit e36bc67
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion infrahub_sdk/testing/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,19 @@ def path(self) -> str:
return str(self.src_directory / self.name)

def init(self) -> None:
shutil.copytree(
dest = shutil.copytree(
src=self.src_directory,
dst=self.dst_directory / self.name,
ignore=shutil.ignore_patterns(".git"),
)
print(dest)

self._repo = GitRepoManager(str(Path(self.dst_directory / self.name)), branch=self.initial_branch)

files = list(
porcelain.get_untracked_paths(self._repo.git.path, self._repo.git.path, self._repo.git.open_index())
)
print(files)
files_to_add = [str(Path(self._repo.git.path) / t) for t in files]
if files_to_add:
porcelain.add(repo=self._repo.git.path, paths=files_to_add)
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def infrahub_version(self) -> str:
return "1.1.0"

async def test_add_repository(self, client: InfrahubClient, remote_repos_dir):
src_directory = get_fixtures_dir() / "integration/repo"
repo = GitRepo(name="test", src_directory=src_directory, dst_directory=remote_repos_dir)
src_directory = get_fixtures_dir() / "integration/mock_repo"
repo = GitRepo(name="mock_repo", src_directory=src_directory, dst_directory=remote_repos_dir)
commit = repo._repo.git[repo._repo.git.head()]
response = await repo.add_to_infrahub(client=client)
repos = await client.all(kind=repo.type)
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/sdk/test_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def mock_init(*args, **kwargs): # noqa: ANN002, ANN003


def test_gitrepo_init(temp_dir):
src_directory = get_fixtures_dir() / "integration/repo"
repo = GitRepo(name="test", src_directory=src_directory, dst_directory=Path(temp_dir))
src_directory = get_fixtures_dir() / "integration/mock_repo"
repo = GitRepo(name="mock_repo", src_directory=src_directory, dst_directory=Path(temp_dir))
assert len(list(repo._repo.git.get_walker())) == 1
commit = repo._repo.git[repo._repo.git.head()]
assert commit.message.decode("utf-8") == "First commit"

0 comments on commit e36bc67

Please sign in to comment.