Skip to content

Commit

Permalink
TST: gitrepo: Add test for runner with non-default protocol
Browse files Browse the repository at this point in the history
The last commit dropped the GitRepo bits from test_protocols.py, which
means we're no longer testing that things seem to get wired up
correctly when a custom runner with a non-default protocol is passed
to GitRunner.  Add a test to test_gitrepo.py to make up for that.
  • Loading branch information
kyleam committed Feb 7, 2019
1 parent 38ac60a commit 2f2fb30
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions datalad/support/tests/test_gitrepo.py
Expand Up @@ -65,6 +65,7 @@
from datalad.support.exceptions import DeprecatedError
from datalad.support.exceptions import CommandError
from datalad.support.exceptions import FileNotInRepositoryError
from datalad.support.protocol import ExecutionTimeProtocol
from .utils import check_repo_deals_with_inode_change


Expand Down Expand Up @@ -1371,3 +1372,18 @@ def __call__(self, x, y=2):
v = Vulnerable()
eq_(v(1, y=3), 4)
eq_(calls, [1, 'precommit'])


@with_tree(tree={"foo": "foo content"})
def test_custom_runner_protocol(path):
# Check that a runner with a non-default protocol gets wired up correctly.
prot = ExecutionTimeProtocol()
gr = GitRepo(path, runner=Runner(cwd=path, protocol=prot), create=True)
eq_(len(prot), 1)
ok_(prot[0]['duration'] >= 0)
gr.add("foo")
eq_(len(prot), 2)
assert_in("add", prot[1]["command"])
gr.commit("commit foo")
eq_(len(prot), 3)
assert_in("commit", prot[2]["command"])

0 comments on commit 2f2fb30

Please sign in to comment.