[Treepkg-commits] r111 - trunk/test

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Jun 26 18:33:15 CEST 2008


Author: bh
Date: 2008-06-26 18:33:14 +0200 (Thu, 26 Jun 2008)
New Revision: 111

Modified:
   trunk/test/test_builder.py
Log:
For log files, use a name under the test specific temp dir to avoid
leaving test files in the current working directory


Modified: trunk/test/test_builder.py
===================================================================
--- trunk/test/test_builder.py	2008-06-26 16:23:26 UTC (rev 110)
+++ trunk/test/test_builder.py	2008-06-26 16:33:14 UTC (rev 111)
@@ -162,11 +162,13 @@
         # sanity check: the binary directory must not exist yet.
         self.failIf(os.path.exists(binary_dir_name))
 
+        logfilename = self.temp_file_name("the_logfile")
+
         builder = PBuilder("my_pbuilderrc", self.root_command)
-        builder.build("my_dsc_file", binary_dir_name, "the_logfile")
+        builder.build("my_dsc_file", binary_dir_name, logfilename)
         self.check_command_line(['/usr/sbin/pbuilder', 'build',
                                  '--configfile', 'my_pbuilderrc',
-                                 '--logfile', 'the_logfile',
+                                 '--logfile', logfilename,
                                  '--buildresult', binary_dir_name,
                                  '--debbuildopts', '-b',
                                  'my_dsc_file'])
@@ -180,15 +182,17 @@
         # sanity check: the binary directory must not exist yet.
         self.failIf(os.path.exists(binary_dir_name))
 
+        logfilename = self.temp_file_name("the_logfile")
+
         builder = PBuilder("my_pbuilderrc", self.root_command)
-        builder.build("my_dsc_file", binary_dir_name, "the_logfile",
+        builder.build("my_dsc_file", binary_dir_name, logfilename,
                       bindmounts=["/home/builder/tracks",
                                   "/home/builder/pbuilder"])
         self.check_command_line(['/usr/sbin/pbuilder', 'build',
                                  '--configfile', 'my_pbuilderrc',
                                  '--bindmounts', "/home/builder/tracks",
                                  '--bindmounts', "/home/builder/pbuilder",
-                                 '--logfile', 'the_logfile',
+                                 '--logfile', logfilename,
                                  '--buildresult', binary_dir_name,
                                  '--debbuildopts', '-b',
                                  'my_dsc_file'])
@@ -202,14 +206,16 @@
         # sanity check: the binary directory must not exist yet.
         self.failIf(os.path.exists(binary_dir_name))
 
+        logfilename = self.temp_file_name("the_logfile")
+
         builder = PBuilder("my_pbuilderrc", self.root_command)
-        builder.build("my_dsc_file", binary_dir_name, "the_logfile",
+        builder.build("my_dsc_file", binary_dir_name, logfilename,
                       extra_packages=["subversion", "texinfo"])
         self.check_command_line(['/usr/sbin/pbuilder', 'build',
                                  '--configfile', 'my_pbuilderrc',
                                  '--extrapackages', "subversion",
                                  '--extrapackages', "texinfo",
-                                 '--logfile', 'the_logfile',
+                                 '--logfile', logfilename,
                                  '--buildresult', binary_dir_name,
                                  '--debbuildopts', '-b',
                                  'my_dsc_file'])
@@ -227,12 +233,14 @@
         # be set yet
         self.failIf("TREEPKG_TEST" in os.environ)
 
+        logfilename = self.temp_file_name("the_logfile")
+
         builder = PBuilder("my_pbuilderrc", self.root_command)
-        builder.build("my_dsc_file", binary_dir_name, "the_logfile",
+        builder.build("my_dsc_file", binary_dir_name, logfilename,
                       extra_env=dict(TREEPKG_TEST=env_test_file))
         self.check_command_line(['/usr/sbin/pbuilder', 'build',
                                  '--configfile', 'my_pbuilderrc',
-                                 '--logfile', 'the_logfile',
+                                 '--logfile', logfilename,
                                  '--buildresult', binary_dir_name,
                                  '--debbuildopts', '-b',
                                  'my_dsc_file'])
@@ -240,40 +248,44 @@
         self.failUnless(os.path.exists(env_test_file))
 
     def test_run_script(self):
+        logfilename = self.temp_file_name("the_logfile")
         builder = PBuilder("my_pbuilderrc", self.root_command)
-        builder.run_script(["my_script"], logfile="the_logfile")
+        builder.run_script(["my_script"], logfile=logfilename)
         self.check_command_line(['/usr/sbin/pbuilder', 'execute',
                                  '--configfile', 'my_pbuilderrc',
-                                 '--logfile', 'the_logfile', '--',
+                                 '--logfile', logfilename, '--',
                                  'my_script'])
 
     def test_run_script_with_arguments(self):
+        logfilename = self.temp_file_name("the_logfile")
         builder = PBuilder("my_pbuilderrc", self.root_command)
-        builder.run_script(["my_script", "--verbose"], logfile="the_logfile")
+        builder.run_script(["my_script", "--verbose"], logfile=logfilename)
         self.check_command_line(['/usr/sbin/pbuilder', 'execute',
                                  '--configfile', 'my_pbuilderrc',
-                                 '--logfile', 'the_logfile', '--',
+                                 '--logfile', logfilename, '--',
                                  'my_script', '--verbose'])
 
     def test_run_script_with_bindmounts(self):
+        logfilename = self.temp_file_name("the_logfile")
         builder = PBuilder("my_pbuilderrc", self.root_command)
-        builder.run_script(["my_script"], logfile="the_logfile",
+        builder.run_script(["my_script"], logfile=logfilename,
                            bindmounts=("/home/builder/foo",
                                        "/home/builder/treepkg"))
         self.check_command_line(['/usr/sbin/pbuilder', 'execute',
                                  '--configfile', 'my_pbuilderrc',
-                                 '--logfile', 'the_logfile',
+                                 '--logfile', logfilename,
                                  '--bindmounts', '/home/builder/foo',
                                  '--bindmounts', '/home/builder/treepkg',
                                  '--', 'my_script'])
 
     def test_run_script_save_after_exec(self):
+        logfilename = self.temp_file_name("the_logfile")
         builder = PBuilder("my_pbuilderrc", self.root_command)
-        builder.run_script(["my_script", "--verbose"], logfile="the_logfile",
+        builder.run_script(["my_script", "--verbose"], logfilename,
                            save_after_exec=True)
         self.check_command_line(['/usr/sbin/pbuilder', 'execute',
                                  '--configfile', 'my_pbuilderrc',
-                                 '--logfile', 'the_logfile',
+                                 '--logfile', logfilename,
                                  '--save-after-exec', '--',
                                  'my_script', '--verbose'])
 



More information about the Treepkg-commits mailing list