Skip to content

Commit a02b871

Browse files
committed
cmd/git(docs[GitTag]): make doctests self-contained with ellipsis
why: Doctests failed due to state pollution - tags from earlier doctests affected later tests; use ELLIPSIS for cleaner pattern matching what: - GitTagCmd.run: create tag, verify with '...test-tag...' - GitTagManager.__init__: create tag, verify with '...init-doctest-tag...' - GitTagManager.run: create tag, verify with '...run-doctest-tag...'
1 parent 6c3d65a commit a02b871

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/libvcs/cmd/git.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5889,7 +5889,7 @@ def run(
58895889
... path=example_git_repo.path,
58905890
... tag_name='test-tag',
58915891
... ).run()
5892-
'test-tag'
5892+
'...test-tag...'
58935893
"""
58945894
local_flags = local_flags if isinstance(local_flags, list) else []
58955895
if command is not None:
@@ -6030,10 +6030,11 @@ def __init__(
60306030
>>> GitTagManager(path=tmp_path).run()
60316031
'fatal: not a git repository (or any of the parent directories): .git'
60326032
6033-
>>> GitTagManager(
6034-
... path=example_git_repo.path
6035-
... ).run()
6033+
>>> mgr = GitTagManager(path=example_git_repo.path)
6034+
>>> mgr.create(name='init-doctest-tag', message='For doctest')
60366035
''
6036+
>>> mgr.run()
6037+
'...init-doctest-tag...'
60376038
"""
60386039
#: Directory to check out
60396040
self.path: pathlib.Path
@@ -6064,8 +6065,11 @@ def run(
60646065
60656066
Examples
60666067
--------
6067-
>>> GitTagManager(path=example_git_repo.path).run()
6068+
>>> mgr = GitTagManager(path=example_git_repo.path)
6069+
>>> mgr.create(name='run-doctest-tag', message='For doctest')
60686070
''
6071+
>>> mgr.run()
6072+
'...run-doctest-tag...'
60696073
"""
60706074
local_flags = local_flags if isinstance(local_flags, list) else []
60716075
if command is not None:

0 commit comments

Comments
 (0)