# HG changeset patch # User domruf # Date 1466112816 -7200 # Node ID 3fff45b4c8edd7931dea33f0e6bdac19a144e7e9 # Parent 7edd336f88d7b6a0bbcfeeb8c6b4915ec6001d6f tests: set EMAIL for Git commit test_push_on_locked_repo_by_other_user_git - it _is_ necessary on some machines 7db1bcf1d95b too aggressively removed setting EMAIL (which was set in a way that didn't work on Windows). On some machines the git commit in _add_files_and_push would fail with 'Please tell me who you are' and the actual test check of "Repository %s locked by user" would fail. On other machines - also without any local git configuration - it works fine. https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables#Committing suggests that it might be a good idea to set it ... so let's do it. (Patch modified by Mads Kiilerich) diff -r 7edd336f88d7 -r 3fff45b4c8ed kallithea/tests/other/manual_test_vcs_operations.py --- a/kallithea/tests/other/manual_test_vcs_operations.py Tue Jun 14 21:32:43 2016 +0200 +++ b/kallithea/tests/other/manual_test_vcs_operations.py Thu Jun 16 23:33:36 2016 +0200 @@ -56,7 +56,7 @@ def __init__(self, cwd): self.cwd = cwd - def execute(self, cmd, *args): + def execute(self, cmd, *args, **environ): """ Runs command on the system with given ``args``. """ @@ -67,7 +67,7 @@ testenv = dict(os.environ) testenv['LANG'] = 'en_US.UTF-8' testenv['LANGUAGE'] = 'en_US:en' - testenv.pop('EMAIL', None) # might not be necessary + testenv.update(environ) p = Popen(command, shell=True, stdout=PIPE, stderr=PIPE, cwd=self.cwd, env=testenv) stdout, stderr = p.communicate() if DEBUG: @@ -116,10 +116,11 @@ Command(cwd).execute('touch %s' % added_file) Command(cwd).execute('%s add %s' % (vcs, added_file)) + email = 'me@example.com' if os.name == 'nt': - author_str = 'User ' + author_str = 'User <%s>' % email else: - author_str = 'User ǝɯɐᴎ ' + author_str = 'User ǝɯɐᴎ <%s>' % email for i in xrange(kwargs.get('files_no', 3)): cmd = """echo "added_line%s" >> %s""" % (i, added_file) Command(cwd).execute(cmd) @@ -131,7 +132,8 @@ cmd = """git commit -m "committed new %s" --author "%s" "%s" """ % ( i, author_str, added_file ) - Command(cwd).execute(cmd) + # git commit needs EMAIL on some machines + Command(cwd).execute(cmd, EMAIL=email) # PUSH it back _REPO = None