Bug 1832284 - Fix rooting hazard in JSObject::swap r=sfink
[gecko.git] / python / mozversioncontrol / test / test_context_manager.py
blob3186a144d92438bf4a1be239f5fc0f98fcf32ef4
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 import mozunit
7 from mozversioncontrol import get_repository_object
10 def test_context_manager(repo):
11 is_git = repo.vcs == "git"
12 cmd = ["show", "--no-patch"] if is_git else ["tip"]
14 vcs = get_repository_object(repo.dir)
15 output_subprocess = vcs._run(*cmd)
16 assert is_git or vcs._client.server is None
17 assert "Initial commit" in output_subprocess
19 with vcs:
20 assert is_git or vcs._client.server is not None
21 output_client = vcs._run(*cmd)
23 assert is_git or vcs._client.server is None
24 assert output_subprocess == output_client
27 if __name__ == "__main__":
28 mozunit.main()