changeset 186:2622bf5ed5bd

For log files, use a name under the test specific temp dir to avoid leaving test files in the current working directory
author Bernhard Herzog <bh@intevation.de>
date Thu, 26 Jun 2008 16:33:14 +0000
parents e1c7cd896310
children b19bf5895a55
files test/test_builder.py
diffstat 1 files changed, 28 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/test/test_builder.py	Thu Jun 26 16:23:26 2008 +0000
+++ b/test/test_builder.py	Thu Jun 26 16:33:14 2008 +0000
@@ -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'])
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)