changeset 7181:07bf8445a393

tests: slight cleanup of test_vcs_operations _add_files_and_push Get rid of odd "cwd = os.path.join(dest_dir)".
author Mads Kiilerich <mads@kiilerich.com>
date Wed, 21 Feb 2018 02:16:55 +0100
parents f72ead70a22f
children 736f058d6172
files kallithea/tests/other/test_vcs_operations.py
diffstat 1 files changed, 6 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/tests/other/test_vcs_operations.py	Wed Nov 29 20:17:02 2017 +0100
+++ b/kallithea/tests/other/test_vcs_operations.py	Wed Feb 21 02:16:55 2018 +0100
@@ -92,12 +92,9 @@
     :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 @@
         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 @@
                 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 @@
 
     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