aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2016-09-12 08:18:50 +0200
committerGuido Günther <agx@sigxcpu.org>2016-09-12 08:52:15 +0200
commit5ff1be8a74b1adf3ecf0597d0cb22d3fc7a499a1 (patch)
treed56be7bca75cc80f7326cb266310a56bc160c5e2
parent473605ca92958cb8deeb270f43291500b13e9ab1 (diff)
test_rpm_ch: use GIT_AUTHOR_* env vars
Use env vars in the test instead of config file otherwise the tests fail if a user uses GIT_AUTHOR_* vars on the command line since these overwrite the config file values.
-rw-r--r--tests/component/rpm/test_rpm_ch.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/component/rpm/test_rpm_ch.py b/tests/component/rpm/test_rpm_ch.py
index 4bc46bd1..3124688a 100644
--- a/tests/component/rpm/test_rpm_ch.py
+++ b/tests/component/rpm/test_rpm_ch.py
@@ -190,11 +190,19 @@ class TestRpmCh(RpmRepoTestBase):
eq_(mock_ch(['--git-author', '--since=HEAD^1']), 0)
# Test the --git-author option
+ saved_author = os.environ.get('GIT_AUTHOR_NAME')
+ saved_email = os.environ.get('GIT_AUTHOR_EMAIL')
+ os.environ['GIT_AUTHOR_NAME'] = 'John Doe'
+ os.environ['GIT_AUTHOR_EMAIL'] = 'jd@host.com'
with open(os.path.join(repo.git_dir, 'config'), 'a') as fobj:
fobj.write('[user]\n name=John Doe\n email=jd@host.com\n')
eq_(mock_ch(['--git-author', '--since=HEAD^']), 0)
header = self.read_file('packaging/gbp-test-native.changes')[0]
ok_(re.match(r'.+ John Doe <jd@host\.com> .+', header), header)
+ if saved_author:
+ os.environ['GIT_AUTHOR_NAME'] = saved_author
+ if saved_email:
+ os.environ['GIT_AUTHOR_EMAIL'] = saved_email
def test_option_full(self):
"""Test the --full cmdline option"""