test: update vc-branch test. default branch could be main as well

This commit is contained in:
Noortheen Raja 2020-10-23 17:55:52 +05:30
parent d4ff96ab25
commit c4ee058e6e
2 changed files with 26 additions and 3 deletions

View file

@ -0,0 +1,23 @@
**Added:**
* <news item>
**Changed:**
* tests for vc-branch should accept both master and main
**Deprecated:**
* <news item>
**Removed:**
* <news item>
**Fixed:**
* <news item>
**Security:**
* <news item>

View file

@ -189,7 +189,7 @@ def test_promptformatter_clears_cache(formatter):
# Xonsh interaction with version control systems.
VC_BRANCH = {"git": "master", "hg": "default"}
VC_BRANCH = {"git": {"master", "main"}, "hg": {"default"}}
@pytest.fixture(scope="module", params=VC_BRANCH.keys())
@ -240,7 +240,7 @@ def test_vc_get_branch(test_repo, xonsh_builtins):
fun = "get_{}_branch".format(test_repo["name"])
obs = getattr(vc, fun)()
if obs is not None:
assert obs == VC_BRANCH[test_repo["name"]]
assert obs in VC_BRANCH[test_repo["name"]]
if test_repo["name"] == "git":
with open("{}/.git/config".format(test_repo["dir"]), "a") as gc:
gc.write(
@ -254,7 +254,7 @@ def test_vc_get_branch(test_repo, xonsh_builtins):
)
obs = getattr(vc, fun)()
if obs is not None:
assert obs == VC_BRANCH[test_repo["name"]]
assert obs in VC_BRANCH[test_repo["name"]]
assert not obs.startswith(u"\u001b[")