コード例 #1
0
ファイル: test_file_utils.py プロジェクト: tismith/snapcraft
    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))
コード例 #2
0
    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))
コード例 #3
0
    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))
コード例 #4
0
ファイル: test_file_utils.py プロジェクト: mvo5/snapcraft
    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))
コード例 #5
0
ファイル: test_file_utils.py プロジェクト: mvo5/snapcraft
    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))
コード例 #6
0
ファイル: test_file_utils.py プロジェクト: 3v1n0/snapcraft
    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))
コード例 #7
0
 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)
コード例 #8
0
 def test_file_does_not_exist(self):
     workdir = self.useFixture(fixtures.TempDir()).path
     self.assertFalse(
         file_utils.executable_exists(os.path.join(workdir,
                                                   'doesnotexist')))
コード例 #9
0
ファイル: test_file_utils.py プロジェクト: mvo5/snapcraft
 def test_file_does_not_exist(self):
     workdir = self.useFixture(fixtures.TempDir()).path
     self.assertFalse(
         file_utils.executable_exists(os.path.join(workdir, "doesnotexist"))
     )
コード例 #10
0
ファイル: _deltas.py プロジェクト: 3v1n0/snapcraft
 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)
コード例 #11
0
ファイル: _deltas.py プロジェクト: mvo5/snapcraft
 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)
コード例 #12
0
 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)