예제 #1
0
 def extract(self, filename):
     """
     Extracts the given file to a temporarily and returns
     the path of the directory with the extracted content.
     """
     prefix = 'django_%s_template_' % self.app_or_project
     tempdir = tempfile.mkdtemp(prefix=prefix, suffix='_extract')
     self.paths_to_remove.append(tempdir)
     if self.verbosity >= 2:
         self.stdout.write("Extracting %s\n" % filename)
     try:
         archive.extract(filename, tempdir)
         return tempdir
     except (archive.ArchiveException, IOError) as e:
         raise CommandError("couldn't extract file %s to %s: %s" %
                            (filename, tempdir, e))
예제 #2
0
 def test_extract_function_no_to_path(self):
     os.chdir(self.tmpdir)
     extract(self.archive_path)
     self.check_files(self.tmpdir)
예제 #3
0
 def test_extract_function(self):
     extract(self.archive_path, self.tmpdir)
     self.check_files(self.tmpdir)