Skip to content
Snippets Groups Projects
Commit 7f926c1f authored by Georges Racinet's avatar Georges Racinet
Browse files

Missing test module

This tests the patch of `ui._runsystem` that forwards
environment variables to external hooks
parent ac6ffc35
No related branches found
No related tags found
No related merge requests found
Pipeline #
from __future__ import absolute_import
from cStringIO import StringIO
from heptapod.testhelpers import (
LocalRepoWrapper,
make_ui,
)
import os
from .utils import common_config
def test_hook(tmpdir):
"""Heptapod environ variables are passed over in hooks."""
out_path = tmpdir.join('out')
config = common_config()
config['hooks'] = dict(commit="echo $HEPTAPOD_VARIABLE > %s" % out_path)
wrapper = LocalRepoWrapper.init(tmpdir.join('repo'), config=config)
wrapper.repo.ui.environ['HEPTAPOD_VARIABLE'] = 'hepta-value'
wrapper.write_commit("foo")
assert out_path.read() == 'hepta-value\n'
def test_none():
"""Test exceptional call with no environment."""
out = StringIO()
ui = make_ui(None)
ui.environ['HEPTAPOD_VARIABLE'] = 'hepta-val'
ui._runsystem(cmd="echo -n $HEPTAPOD_VARIABLE",
environ=None,
cwd=os.getcwd(),
out=out)
assert out.getvalue() == 'hepta-val'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment