def testFindResourceDirSuccess(self): currentDirectory = os.getcwd() self.logger.info(f"cwd: '{currentDirectory}'") newDir = "resources" os.mkdir(newDir) resourceDir = ResourceUtility.find_resource_dir() self.assertIsNotNone(resourceDir, "Failed to return something") self.assertEqual(resourceDir.lower(), f"{currentDirectory}/resources".lower(), "Found in wrong place") os.rmdir("resources")
def makeImageMultiChoice(cls): cls.classLogger.debug( f"Resource directory: {ResourceUtility.find_resource_dir()}") pathToImages = ResourceUtility.find_resource_dir( ) + "/" + IMAGE_RESOURCES_SUBDIR cls.classLogger.debug(f"Path to images: {pathToImages}") choiceImages = [] for imageFileName in DEMO_IMAGES: imagePath = os.path.join(pathToImages, imageFileName) cls.classLogger.debug(f"Image Path: {imagePath}") choiceImage = pygame.image.load(imagePath) choiceImages.append(choiceImage) imageMultiChoice = ImageMultiChoice(images=choiceImages, values=DEMO_IMAGE_VALUES) return imageMultiChoice
def testFindResourceDirFailure(self): ResourceUtility.find_resource_dir()