def test_mkdir_illegalDuplication(self): services.mkdir(TEST_PATH) try: services.mkdir(TEST_PATH) except OSError: pass else: self.fail("An OS-Error exception is expected!") self.assertTrue(os.path.isdir(TEST_PATH))
def generate(self): variables = self.__constructVariablesInitialization() fileContext = _makFileTemplate.format( variables=variables, tool_path=toPosixPath(os.path.relpath(attributes.TOOL_PATH)), product_file_path=self.__productFilePath) fileName = attributes.AUTO_GENERATED_MAKEFILE directory = os.path.dirname(fileName) mkdir(directory, exist_ok=True) fileHandle = open(fileName, 'w') fileHandle.write(fileContext) fileHandle.flush() fileHandle.close()
def __prepareIdeFileTreeStructure(self, contents): dummiesLocation = os.path.join(self.__ideLocation, "dummies") mkdir(self.__ideLocation, exist_ok=True) mkdir(dummiesLocation, exist_ok=True) target = os.path.abspath( os.path.join(self.__ideLocation, contents.makefile)) if not os.path.isfile(target): createLink(contents.makefile, target) for name in self.__getItems(StatMakefile.INTERFACES): target = os.path.abspath(os.path.join(dummiesLocation, name)) source = os.path.join(attributes.DUMMIES_DIRECTORY, name) if not os.path.isfile(target): createLink(source, target)
def generateFilename(prefix=''): mkdir(attributes.OUTPUT_DIRECTORY, exist_ok=True) filename = re.sub( r'[^\w.]', '', '_{0}_{1}.csv'.format(prefix, '_'.join([arg for arg in sys.argv[1:]]))) return '/'.join([attributes.OUTPUT_DIRECTORY, filename])
def prepareOutputDirectories(): remove(attributes.LOGS_DIRECTORY) mkdir(attributes.LOGS_DIRECTORY) mkdir(attributes.OUTPUT_DIRECTORY, exist_ok=True)
def write(self): mkdir(attributes.IDE_DIRECTORY, exist_ok=True) self.__addFileTree(self.__contents.tree, self.__writer.createRootToken()) self.__writer.write()
def test_mkdir_formalDuplication(self): services.mkdir(TEST_PATH) services.mkdir(TEST_PATH, exist_ok=True) self.assertTrue(os.path.isdir(TEST_PATH))
def test_mkdir_basic(self): services.mkdir(TEST_PATH) self.assertTrue(os.path.isdir(TEST_PATH))