Index: Source/Pythontest/TestInstall.py
===================================================================
--- Source/Pythontest/TestInstall.py	(revision 76c37a99c13dbe456f0aa5adcf7439778e84a4c3)
+++ Source/Pythontest/TestInstall.py	(revision 80281769fb906cbf4c8c64994964373c213ce779)
@@ -19,4 +19,5 @@
 import pytest
 from mock import patch
+import mock
 
 sys.path.append('../Python')
@@ -53,7 +54,8 @@
 
 
-    @patch('tarfile.open', side_effect=[subprocess.CalledProcessError(1,'test'),
-                                        OSError(errno.EEXIST)])
+    @patch('tarfile.open', side_effect=[tarfile.TarError, OSError])
     def test_fail_mk_tarball_local(self, mock_open):
+        import tarfile
+       # mock_open.side_effekt = tarfile.TarError
         ecd = _config.PATH_FLEXEXTRACT_DIR + os.path.sep
         # create test tarball and list its content files
@@ -62,4 +64,5 @@
         with pytest.raises(SystemExit):
             mk_tarball(ecd + tarballname, 'local')
+
 
     def test_success_mk_tarball_local(self):
@@ -119,12 +122,7 @@
         # list comparison files for tarball content
         tar_test_dir = os.path.join(self.testdir, 'InstallTar')
-        cmp_dir = _config.FLEXEXTRACT_DIRNAME + '_ecgate'
-        tar_test_fedir = os.path.join(tar_test_dir, cmp_dir)
-        comparison_list = []
-        for path, subdirs, files in os.walk(tar_test_fedir):
-            for name in files:
-                if 'tar' not in name:
-                    comparison_list.append(os.path.relpath(
-                        os.path.join(path, name), tar_test_fedir))
+        tarballname = _config.FLEXEXTRACT_DIRNAME + '_ecgate.tar'
+        with tarfile.open(os.path.join(tar_test_dir, tarballname), 'r') as tar_handle:
+            comparison_list = tar_handle.getnames()
 
         # untar in test directory
@@ -132,5 +130,4 @@
         make_dir(test_dir)
         os.chdir(test_dir)
-        tarballname = _config.FLEXEXTRACT_DIRNAME + '_ecgate.tar'
         un_tarball(os.path.join(tar_test_dir, tarballname))
         tarfiles_list = []
@@ -148,12 +145,7 @@
         # list comparison files for tarball content
         tar_test_dir = os.path.join(self.testdir, 'InstallTar')
-        cmp_dir = _config.FLEXEXTRACT_DIRNAME + '_local'
-        tar_test_fedir = os.path.join(tar_test_dir, cmp_dir)
-        comparison_list = []
-        for path, subdirs, files in os.walk(tar_test_fedir):
-            for name in files:
-                if 'tar' not in name:
-                    comparison_list.append(os.path.relpath(
-                        os.path.join(path, name), tar_test_fedir))
+        tarballname = _config.FLEXEXTRACT_DIRNAME + '_local.tar'
+        with tarfile.open(os.path.join(tar_test_dir, tarballname), 'r') as tar_handle:
+            comparison_list = tar_handle.getnames()
 
         # untar in test directory
@@ -161,5 +153,4 @@
         make_dir(test_dir)
         os.chdir(test_dir)
-        tarballname = _config.FLEXEXTRACT_DIRNAME + '_local.tar'
         un_tarball(os.path.join(tar_test_dir, tarballname))
         tarfiles_list = []
@@ -168,5 +159,5 @@
                 tarfiles_list.append(os.path.relpath(
                     os.path.join(path, name), test_dir))
-
+        		   
         # test for equality
         assert sorted(tarfiles_list) == sorted(comparison_list)
@@ -205,12 +196,4 @@
                             'user@destination')
 
-    @patch('__builtin__.open', side_effect=[OSError(errno.EPERM)])
-    def test_fail_open_mk_env_vars(self, mock_open):
-        with pytest.raises(SystemExit):
-            mk_env_vars('testuser',
-                        'testgroup',
-                        'gateway.test.ac.at',
-                        'user@destination')
-
     @patch('_config.FILE_INSTALL_COMPILEJOB', _config_test.PATH_TESTFILES_DIR+'/compilejob_test.ksh')
     def test_success_mk_compilejob(self):
@@ -221,5 +204,4 @@
 
         mk_compilejob('Makefile.TEST',
-                      '',
                       'testuser',
                       'testgroup',
@@ -236,5 +218,4 @@
         with pytest.raises(SystemExit):
             mk_compilejob('Makefile.TEST',
-                          '',
                           'testuser',
                           'testgroup',
@@ -246,29 +227,27 @@
             with pytest.raises(SystemExit):
                 mk_compilejob('Makefile.TEST',
-                              '',
                               'testuser',
                               'testgroup',
                               'fp_root_test_path')
 
-    @patch('__builtin__.open', side_effect=[OSError(errno.EPERM)])
-    def test_fail_open_mk_compilejob(self, mock_open):
-        with pytest.raises(SystemExit):
-            mk_compilejob('Makefile.TEST',
-                          '',
-                          'testuser',
-                          'testgroup',
-                          'fp_root_test_path')
-
-    @patch('_config.TEMPFILE_JOB', _config_test.PATH_TESTFILES_DIR+'/job_temp.test_test')
+#    @patch('builtins.open', side_effect=[OSError(errno.EPERM)])
+#    def test_fail_open_mk_compilejob(self, mock_open):
+#        with pytest.raises(SystemExit):
+#            mk_compilejob('Makefile.TEST',
+#                          'testuser',
+#                          'testgroup',
+#                          'fp_root_test_path')
+
+    @patch('_config.TEMPFILE_JOB', _config_test.PATH_TESTFILES_DIR+'/submitscript.template.test.comp')
     def test_success_mk_job_template(self):
         import filecmp
 
         testfile = os.path.join(self.testfilesdir,
-                                'job.temp.test')
+                                'submitscript.template.test')
 
         mk_job_template('testuser',
                         'testgroup',
-                        'gateway.test.ac.at',
-                        'dest@generic',
+#                        'gateway.test.ac.at',
+#                        'dest@generic',
                         'fp_root_test_path')
 
@@ -284,6 +263,6 @@
             mk_job_template('testuser',
                             'testgroup',
-                            'gateway.test.ac.at',
-                            'dest@generic',
+#                            'gateway.test.ac.at',
+#                            'dest@generic',
                             'fp_root_test_path')
 
@@ -294,16 +273,16 @@
                 mk_job_template('testuser',
                                 'testgroup',
-                                'gateway.test.ac.at',
-                                'dest@generic',
+ #                               'gateway.test.ac.at',
+ #                               'dest@generic',
                                 'fp_root_test_path')
 
-    @patch('__builtin__.open', side_effect=[OSError(errno.EPERM)])
-    def test_fail_open_mk_job_template(self, mock_open):
-        with pytest.raises(SystemExit):
-            mk_job_template('testuser',
-                            'testgroup',
-                            'gateway.test.ac.at',
-                            'dest@generic',
-                            'fp_root_test_path')
+#    @patch('builtins.open', side_effect=[OSError(errno.EPERM)])
+#    def test_fail_open_mk_job_template(self, mock_open):
+#        with pytest.raises(SystemExit):
+#            mk_job_template('testuser',
+#                            'testgroup',
+#                            'gateway.test.ac.at',
+#                            'dest@generic',
+#                            'fp_root_test_path')
 
     @classmethod
