changeset 5981:3fff45b4c8ed

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)
author domruf <dominikruf@gmail.com>
date Thu, 16 Jun 2016 23:33:36 +0200
parents 7edd336f88d7
children f55891e42e0e
files kallithea/tests/other/manual_test_vcs_operations.py
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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 <me@example.com>'
+        author_str = 'User <%s>' % email
     else:
-        author_str = 'User ǝɯɐᴎ <me@example.com>'
+        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