forked from expo/troggle
tidy bad git messages in tests
This commit is contained in:
parent
dfc903208e
commit
29dc99c21f
@ -152,22 +152,24 @@ class SubprocessTest(TestCase):
|
||||
TROGGLE_PATH = Path(settings.REPOS_ROOT_PATH) / "troggle"
|
||||
for cwd in [settings.SURVEX_DATA, settings.EXPOWEB, settings.DRAWINGS_DATA, TROGGLE_PATH]:
|
||||
sp = subprocess.run([settings.GIT, "status"], cwd=cwd, capture_output=True, text=True)
|
||||
scwd = str(cwd)
|
||||
# print(scwd + ":\n\n#" + sp.stderr + '\n\n#' + sp.stdout + '\n\n# return code: ' + str(sp.returncode))
|
||||
print(f'git output: {cwd}:\n # {sp.stderr=}\n # {sp.stdout=} \n # return code: {str(sp.returncode)}')
|
||||
if sp.returncode != 0:
|
||||
print(scwd + ":\n\n" + sp.stderr + '\n\n' + sp.stdout + '\n\nreturn code: ' + str(sp.returncode))
|
||||
self.assertTrue( sp.returncode == 0, f'{scwd} - git is unhappy')
|
||||
print(f'git output: {cwd}:\n # {sp.stderr=}\n # {sp.stdout=} \n # return code: {str(sp.returncode)}')
|
||||
|
||||
self.assertTrue( sp.returncode == 0, f'{cwd} - git is unhappy')
|
||||
|
||||
content = sp.stdout
|
||||
ph = r'Your branch is up[ -]to[ -]date'
|
||||
phmatch = re.search(ph, content)
|
||||
self.assertIsNotNone(phmatch, f"{scwd} - Failed to find expected git output: '" + ph +"'")
|
||||
msg = f'{cwd} - Failed to find expected git output: "{ph}"'
|
||||
self.assertIsNotNone(phmatch, msg)
|
||||
|
||||
ph1 = r'no changes added to commit'
|
||||
phmatch1 = re.search(ph1, content)
|
||||
ph2 = r'nothing to commit'
|
||||
phmatch2 = re.search(ph2, content)
|
||||
phmatch = phmatch1 or phmatch2
|
||||
self.assertIsNotNone(phmatch, f"{scwd} - Failed to find expected git output: {ph1} or {ph2}")
|
||||
msg = f'{cwd} - Failed to find expected git output: "{ph1}" or "{ph2}"'
|
||||
self.assertIsNotNone(phmatch, msg)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user