Add e2e test for repos status
This commit is contained in:
@@ -186,6 +186,37 @@ class TempGitRepositoryWorktree:
|
|||||||
del self.remote_2_dir
|
del self.remote_2_dir
|
||||||
|
|
||||||
|
|
||||||
|
class RepoTree:
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
self.root = tempfile.TemporaryDirectory()
|
||||||
|
self.config = tempfile.NamedTemporaryFile()
|
||||||
|
with open(self.config.name, "w") as f:
|
||||||
|
f.write(
|
||||||
|
f"""
|
||||||
|
[[trees]]
|
||||||
|
root = "{self.root.name}"
|
||||||
|
|
||||||
|
[[trees.repos]]
|
||||||
|
name = "test"
|
||||||
|
|
||||||
|
[[trees.repos]]
|
||||||
|
name = "test_worktree"
|
||||||
|
worktree_setup = true
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
cmd = grm(["repos", "sync", "--config", self.config.name])
|
||||||
|
assert cmd.returncode == 0
|
||||||
|
return (self.root.name, self.config.name, ["test", "test_worktree"])
|
||||||
|
|
||||||
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||||
|
del self.root
|
||||||
|
del self.config
|
||||||
|
|
||||||
|
|
||||||
class EmptyDir:
|
class EmptyDir:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|||||||
13
e2e_tests/test_repos_status.py
Normal file
13
e2e_tests/test_repos_status.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import tempfile
|
||||||
|
|
||||||
|
from helpers import *
|
||||||
|
|
||||||
|
|
||||||
|
def test_repos_sync_worktree_clone():
|
||||||
|
with RepoTree() as (root, config, repos):
|
||||||
|
cmd = grm(["repos", "status", "--config", config])
|
||||||
|
assert cmd.returncode == 0
|
||||||
|
for repo in repos:
|
||||||
|
assert repo in cmd.stdout
|
||||||
Reference in New Issue
Block a user