def test_removeUponAntiVirusLockups(self): retries = 3 rmTreePatcher = self._patchRmtree(retries=retries) osRemovePatcher = self._patchOsRemove(retries=retries) self._emulateNonEmptyFileTree() services.remove(OUTPUT_DIRECTORY) self.assertFalse(osRemovePatcher.called) self.assertEqual([call(OUTPUT_DIRECTORY)] * (retries + 1), rmTreePatcher.call_args_list)
def test_removeFile(self): retries = 2 fileName = 'full_example.mak' filePath = os.path.join(OUTPUT_DIRECTORY, fileName) os.makedirs(OUTPUT_DIRECTORY) copyfile('full_example.mak', filePath) rmTreePatcher = self._patchRmtree(retries=retries) osRemovePatcher = self._patchOsRemove(retries=retries) services.remove(filePath) self.assertFalse(rmTreePatcher.called) self.assertEqual([call(filePath)] * (retries + 1), osRemovePatcher.call_args_list)
def setUp(self): self._doBeforeSetup() self.patch(CUT, isWindows.__name__, return_value=self.isOnWindows) self.maxDiff = None if not os.path.isdir(attributes.IDE_DIRECTORY): os.mkdir(attributes.IDE_DIRECTORY) remove(TEST_IDE_DIRECTORY) self.makefileProject = StatMakefileProject(TEST_MAKEFILE) self.writer = VsCodeWriter(self.makefileProject) namespace = "ide_{0}".format(TEST_TARGET_NAME) command = formatMakeCommand(TEST_MAKEFILE, STAT_NAMESPACE=namespace) self.makeTool = command[0] self.makeArguments = command[1:] self.foldersInitConfig = [{ "name": TEST_IDE_DIRECTORY, "path": os.path.abspath(TEST_IDE_DIRECTORY) }]
def prepareOutputDirectories(): remove(attributes.LOGS_DIRECTORY) mkdir(attributes.LOGS_DIRECTORY) mkdir(attributes.OUTPUT_DIRECTORY, exist_ok=True)
def tearDown(self): directory = os.path.dirname(attributes.AUTO_GENERATED_MAKEFILE) remove(directory)
def setUp(self): directory = os.path.dirname(attributes.AUTO_GENERATED_MAKEFILE) remove(directory) self.buildToolsCrawler = self.patch(CUT, BuildToolsCrawler.__name__, auto_spec=True) self.buildToolsCrawler.return_value.getBuildAttributes.return_value = TEST_TOOL_ATTRIBUTES
def tearDown(self): remove(TEST_IDE_DIRECTORY)
def setUp(self): services.remove(OUTPUT_DIRECTORY)
def test_remove(self): self._emulateNonEmptyFileTree() services.remove(OUTPUT_DIRECTORY) self.assertFalse(os.path.isdir(OUTPUT_DIRECTORY))
def tearDown(self): self._fakeOs.restoreOriginalModule() services.remove(OUTPUT_DIRECTORY)
def setUp(self): self._fakeOs = FakeOs('services') services.remove(OUTPUT_DIRECTORY)