Changeset - 07bf8445a393
[Not reviewed]
default
0 1 0
Mads Kiilerich - 8 years ago 2018-02-21 02:16:55
mads@kiilerich.com
tests: slight cleanup of test_vcs_operations _add_files_and_push

Get rid of odd "cwd = os.path.join(dest_dir)".
1 file changed with 6 insertions and 9 deletions:
0 comments (0 inline, 0 general)
kallithea/tests/other/test_vcs_operations.py
Show inline comments
 
@@ -92,12 +92,9 @@ def _add_files_and_push(webserver, vcs, 
 
    :param vcs:
 
    :param dest_dir:
 
    """
 
    # commit some stuff into this repo
 
    cwd = os.path.join(dest_dir)
 
    #added_file = '%ssetupążźć.py' % _RandomNameSequence().next()
 
    added_file = '%ssetup.py' % _RandomNameSequence().next()
 
    open(os.path.join(cwd, added_file), 'a').close()
 
    Command(cwd).execute('%s add %s' % (vcs, added_file))
 
    open(os.path.join(dest_dir, added_file), 'a').close()
 
    Command(dest_dir).execute('%s add %s' % (vcs, added_file))
 

	
 
    email = 'me@example.com'
 
    if os.name == 'nt':
 
@@ -106,7 +103,7 @@ def _add_files_and_push(webserver, vcs, 
 
        author_str = 'User ǝɯɐᴎ <%s>' % email
 
    for i in xrange(files_no):
 
        cmd = """echo "added_line%s" >> %s""" % (i, added_file)
 
        Command(cwd).execute(cmd)
 
        Command(dest_dir).execute(cmd)
 
        if vcs == 'hg':
 
            cmd = """hg commit -m "committed new %s" -u "%s" "%s" """ % (
 
                i, author_str, added_file
 
@@ -116,7 +113,7 @@ def _add_files_and_push(webserver, vcs, 
 
                i, author_str, added_file
 
            )
 
        # git commit needs EMAIL on some machines
 
        Command(cwd).execute(cmd, EMAIL=email)
 
        Command(dest_dir).execute(cmd, EMAIL=email)
 

	
 
    # PUSH it back
 
    _REPO = None
 
@@ -130,9 +127,9 @@ def _add_files_and_push(webserver, vcs, 
 

	
 
    stdout = stderr = None
 
    if vcs == 'hg':
 
        stdout, stderr = Command(cwd).execute('hg push --verbose', clone_url, ignoreReturnCode=ignoreReturnCode)
 
        stdout, stderr = Command(dest_dir).execute('hg push --verbose', clone_url, ignoreReturnCode=ignoreReturnCode)
 
    elif vcs == 'git':
 
        stdout, stderr = Command(cwd).execute('git push --verbose', clone_url, "master", ignoreReturnCode=ignoreReturnCode)
 
        stdout, stderr = Command(dest_dir).execute('git push --verbose', clone_url, "master", ignoreReturnCode=ignoreReturnCode)
 

	
 
    return stdout, stderr
 

	
0 comments (0 inline, 0 general)