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('subprocess') wrapper.setOption('user', '') wrapper.run(removeTask)
def testUpython2(self): """ Test that the upython3 subprocess works properly. """ resource = Resource.get() resource.load(self.__taskPath) crawler = FsPath.createFromPath(self.__sourcePath) dummyTask = Task.create('uPythonMajorVerTestTask') dummyTask.add(crawler) wrapper = TaskWrapper.create("upython2") result = wrapper.run(dummyTask) self.assertTrue(len(result), 1) self.assertEqual(result[0].var("majorVer"), 2)
def _perform(self): sourceCrawler = self.crawlers()[0] if self.option('runUPython'): dummyTask = Task.create('uPythonTestTask') dummyTask.setOption("runUPython", False) dummyTask.add(sourceCrawler) wrapper = TaskWrapper.create('upython') result = wrapper.run(dummyTask) else: import OpenImageIO sourceCrawler.setVar("testUPython", OpenImageIO.VERSION) result = [sourceCrawler.clone()] return result
def testUPython(self): """ Test that the UPython subprocess works properly. """ resource = Resource.get() resource.load(self.__taskPath) crawler = FsPath.createFromPath(self.__sourcePath) dummyTask = Task.create('uPythonTestTask') dummyTask.add(crawler) dummyTask.setOption("runUPython", False) wrapper = TaskWrapper.create('upython') result = wrapper.run(dummyTask) self.assertTrue(len(result), 1) self.assertIn("testUPython", result[0].varNames()) self.assertEqual(result[0].var("testUPython"), OpenImageIO.VERSION)