def test_file_exists_but_not_readable(self): workdir = self.useFixture(fixtures.TempDir()).path path = os.path.join(workdir, 'notreadable') with open(path, 'wb'): pass os.chmod(path, 0) self.assertFalse(file_utils.executable_exists(path))
def test_file_exists_but_not_executable(self): workdir = self.useFixture(fixtures.TempDir()).path path = os.path.join(workdir, "notexecutable") with open(path, "wb"): pass os.chmod(path, 0o444) self.assertFalse(file_utils.executable_exists(path))
def test_executable_exists_and_executable(self): workdir = self.useFixture(fixtures.TempDir()).path path = os.path.join(workdir, 'notexecutable') with open(path, 'wb'): pass os.chmod(path, 0o555) self.assertTrue(file_utils.executable_exists(path))
def test_file_exists_but_not_readable(self): workdir = self.useFixture(fixtures.TempDir()).path path = os.path.join(workdir, "notreadable") with open(path, "wb"): pass os.chmod(path, 0) self.assertFalse(file_utils.executable_exists(path))
def test_executable_exists_and_executable(self): workdir = self.useFixture(fixtures.TempDir()).path path = os.path.join(workdir, "notexecutable") with open(path, "wb"): pass os.chmod(path, 0o555) self.assertTrue(file_utils.executable_exists(path))
def test_file_exists_but_not_executable(self): workdir = self.useFixture(fixtures.TempDir()).path path = os.path.join(workdir, 'notexecutable') with open(path, 'wb'): pass os.chmod(path, 0o444) self.assertFalse(file_utils.executable_exists(path))
def _check_delta_gen_tool(self): """Check if the delta generation tool exists""" path_exists = file_utils.executable_exists(self.delta_tool_path) on_system = shutil.which(self.delta_tool_path) if not (path_exists or on_system): raise DeltaToolError(delta_tool=self.delta_tool_path)
def test_file_does_not_exist(self): workdir = self.useFixture(fixtures.TempDir()).path self.assertFalse( file_utils.executable_exists(os.path.join(workdir, 'doesnotexist')))
def test_file_does_not_exist(self): workdir = self.useFixture(fixtures.TempDir()).path self.assertFalse( file_utils.executable_exists(os.path.join(workdir, "doesnotexist")) )
def _check_delta_gen_tool(self): """Check if the delta generation tool exists""" if not file_utils.executable_exists(self.delta_tool_path): raise DeltaToolError(delta_tool=self.delta_tool_path)