diff options
author | Philip Sargent <philip.sargent@klebos.com> | 2022-03-05 17:42:12 +0000 |
---|---|---|
committer | Philip Sargent <philip.sargent@klebos.com> | 2022-03-05 17:42:12 +0000 |
commit | 5fe436e76a8b569b7ce8937b24be69b7b4261cfc (patch) | |
tree | b24e8d2c239f6f9c43452ef3dc32904baedadd37 /core/TESTS | |
parent | d7fd6b00ae6845e5dfb7263a4f440e7ab36c145c (diff) | |
download | troggle-5fe436e76a8b569b7ce8937b24be69b7b4261cfc.tar.gz troggle-5fe436e76a8b569b7ce8937b24be69b7b4261cfc.tar.bz2 troggle-5fe436e76a8b569b7ce8937b24be69b7b4261cfc.zip |
Add git status test for 3 repos
Diffstat (limited to 'core/TESTS')
-rw-r--r-- | core/TESTS/test_imports.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/core/TESTS/test_imports.py b/core/TESTS/test_imports.py index 3104a72..d8bbe42 100644 --- a/core/TESTS/test_imports.py +++ b/core/TESTS/test_imports.py @@ -134,5 +134,29 @@ class SubprocessTest(TestCase): except subprocess.CalledProcessError: self.assertTrue( False, f'no {i} installed') + def test_repos_git_status(self): + '''Expects a clean git repo with no added files and no merge failures + ''' + from pathlib import Path + import troggle.settings as settings + for cwd in [settings.EXPOWEB, settings.DRAWINGS_DATA, Path(settings.REPOS_ROOT_PATH) / "troggle"]: # add settings.SURVEX_DATA when loser is gitified + + sp = subprocess.run([settings.GIT, "status"], cwd=cwd, capture_output=True, text=True) + print(str(cwd) + ":\n\n" + sp.stderr + '\n\n' + sp.stdout + '\n\nreturn code: ' + str(sp.returncode)) + if sp.returncode != 0: + print(str(cwd) + ":\n\n" + sp.stderr + '\n\n' + sp.stdout + '\n\nreturn 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"{cwd} - Failed to find expected git output: '" + ph +"'") + + 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"{cwd} - Failed to find expected git output: {ph1} or {ph2}") |