2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-12 00:06:36 +00:00

test: handle if branch switching breaks

This commit is contained in:
Gavin D'souza 2020-05-14 20:08:48 +05:30
parent b0f3bd4cdd
commit 7f93674c52

View File

@ -136,13 +136,15 @@ class TestBenchInit(TestBenchBase):
bench_path = os.path.join(self.benches_path, "test-bench")
app_path = os.path.join(bench_path, "apps", "frappe")
bench.utils.exec_cmd("bench switch-to-branch version-12 frappe --upgrade", cwd=bench_path)
successful_switch = not bench.utils.exec_cmd("bench switch-to-branch version-12 frappe --upgrade", cwd=bench_path)
app_branch_after_switch = str(git.Repo(path=app_path).active_branch)
self.assertEqual("version-12", app_branch_after_switch)
if successful_switch:
self.assertEqual("version-12", app_branch_after_switch)
bench.utils.exec_cmd("bench switch-to-branch develop frappe --upgrade", cwd=bench_path)
successful_switch = not bench.utils.exec_cmd("bench switch-to-branch develop frappe --upgrade", cwd=bench_path)
app_branch_after_second_switch = str(git.Repo(path=app_path).active_branch)
self.assertEqual("develop", app_branch_after_second_switch)
if successful_switch:
self.assertEqual("develop", app_branch_after_second_switch)
if __name__ == '__main__':