Changeset - 3fff45b4c8ed
[Not reviewed]
default
0 1 0
domruf - 9 years ago 2016-06-16 23:33:36
dominikruf@gmail.com
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)
1 file changed with 7 insertions and 5 deletions:
0 comments (0 inline, 0 general)
kallithea/tests/other/manual_test_vcs_operations.py
Show inline comments
 
@@ -56,7 +56,7 @@ class Command(object):
 
    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 @@ class Command(object):
 
        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 @@ def _add_files_and_push(vcs, DEST, **kwa
 
    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 @@ def _add_files_and_push(vcs, DEST, **kwa
 
            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
0 comments (0 inline, 0 general)