Skip to content

Commit e088abc

Browse files
committed
url/base(fix[doctest]): unregister demo rule after example
why: The RuleMap.register doctest added 'gl-prefix' to the global GitURL.rule_map without removing it, unlike the git/svn/hg examples which clean up. The leaked rule persisted into later tests. what: - Unregister 'gl-prefix' at the end of the example
1 parent 6ed2c9e commit e088abc

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/libvcs/url/base.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@ def register(self, cls: Rule) -> None:
178178
>>> GitURL.is_valid(url='gitlab:vcs-python/libvcs')
179179
True
180180
181+
Clean up so the examples below see the default rules:
182+
183+
>>> GitURL.rule_map.unregister('gl-prefix')
184+
181185
**Example: git URLs + pip-style git URLs:**
182186
183187
This is already in :class:`GitURL` via :data:`PIP_DEFAULT_RULES`. For the

0 commit comments

Comments
 (0)