Esempio n. 1
0
 def testPrependAllowed(self):
     temp_handle, temp_name = tempfile.mkstemp()
     chromium_step.Prepend(temp_name, '111', self.output_dir,
                           self.perf_output_dir)
     self.assertTrue(_readData(temp_name), '111')
     os.close(temp_handle)
     os.unlink(temp_name)
Esempio n. 2
0
    def testPrependAllowedSubDir(self):
        # Use mkdtemp() just to generate a unique filename.
        temp_name = self._generateTempName(self.output_dir)

        # Create a path containing a sub-directory of the output_dir. Make sure it
        # doesn't exist so we can verify it's created.
        subdir = os.path.join(self.output_dir, temp_name)

        subdir_file = os.path.join(subdir, temp_name)
        self.assertFalse(os.path.exists(subdir_file))
        try:
            chromium_step.Prepend(subdir_file, '222', self.output_dir,
                                  self.perf_output_dir)

            # Verify the subdir was also created, in addition to the file.
            self.assertTrue(os.path.exists(subdir))
            self.assertTrue(os.path.exists(subdir_file))
            self.assertTrue(_readData(subdir_file), '222')
        finally:
            shutil.rmtree(subdir)
Esempio n. 3
0
 def dummy_func():
     chromium_step.Prepend(invalid_filename, '333', self.output_dir,
                           self.perf_output_dir)
Esempio n. 4
0
 def testPrependAllowed(self):
     with tempfile.NamedTemporaryFile(dir=self.output_dir) as temp_file:
         chromium_step.Prepend(temp_file.name, '111', self.output_dir,
                               self.perf_output_dir)
         self.assertTrue(_readData(temp_file.name), '111')