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/.
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
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__":