Ejemplo n.º 1
0
 def cleanup(self, crawlers):
     """
     Remove the data that was copied.
     """
     removeTask = Task.create('remove')
     for crawler in crawlers:
         removeTask.add(crawler, crawler.var("filePath"))
     wrapper = TaskWrapper.create('python')
     wrapper.setOption('user', '')
     wrapper.run(removeTask)
Ejemplo n.º 2
0
    def testPython2(self):
        """
        Test that the python3 subprocess works properly.
        """
        resource = Resource.get()
        resource.load(self.__taskPath)
        crawler = FsCrawler.createFromPath(self.__sourcePath)
        dummyTask = Task.create('pythonMajorVerTestTask')
        dummyTask.add(crawler)

        wrapper = TaskWrapper.create("python2")
        result = wrapper.run(dummyTask)
        self.assertTrue(len(result), 1)
        self.assertEqual(result[0].var("majorVer"), 2)
Ejemplo n.º 3
0
    def _perform(self):
        sourceCrawler = self.crawlers()[0]
        if self.option('runPython'):
            dummyTask = Task.create('pythonTestTask')
            dummyTask.setOption("runPython", False)
            dummyTask.add(sourceCrawler)
            wrapper = TaskWrapper.create('python')
            result = wrapper.run(dummyTask)
        else:
            import OpenImageIO
            sourceCrawler.setVar("testPython", OpenImageIO.VERSION)
            result = [sourceCrawler.clone()]

        return result
Ejemplo n.º 4
0
 def testPython(self):
     """
     Test that the Python subprocess works properly.
     """
     resource = Resource.get()
     resource.load(self.__taskPath)
     crawler = FsCrawler.createFromPath(self.__sourcePath)
     dummyTask = Task.create('pythonTestTask')
     dummyTask.add(crawler)
     dummyTask.setOption("runPython", False)
     wrapper = TaskWrapper.create('python')
     result = wrapper.run(dummyTask)
     self.assertTrue(len(result), 1)
     self.assertIn("testPython", result[0].varNames())
     self.assertEqual(result[0].var("testPython"), OpenImageIO.VERSION)
Ejemplo n.º 5
0
class Python2TaskWrapperTest(BaseTestCase):
    """Test python 2 subprocess."""

    __sourcePath = os.path.join(BaseTestCase.dataTestsDirectory(), "test.exr")
    __taskPath = os.path.join(BaseTestCase.dataTestsDirectory(), "tasks",
                              "PythonMajorVerTestTask.py")

    @unittest.skipIf(not distutils.spawn.find_executable(
        TaskWrapper.create('python2').option('executableName')),
                     "python2 is not available on search path")
    def testPython2(self):
        """
        Test that the python3 subprocess works properly.
        """
        resource = Resource.get()
        resource.load(self.__taskPath)
        crawler = FsCrawler.createFromPath(self.__sourcePath)
        dummyTask = Task.create('pythonMajorVerTestTask')
        dummyTask.add(crawler)

        wrapper = TaskWrapper.create("python2")
        result = wrapper.run(dummyTask)
        self.assertTrue(len(result), 1)
        self.assertEqual(result[0].var("majorVer"), 2)