python类DirectorySandbox()的实例源码

test_sandbox.py 文件源码 项目:Flask_Blog 作者: sugarguo 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def test_win32com(self):
            """
            win32com should not be prevented from caching COM interfaces
            in gen_py.
            """
            import win32com
            gen_py = win32com.__gen_path__
            target = os.path.join(gen_py, 'test_write')
            sandbox = DirectorySandbox(self.dir)
            try:
                try:
                    sandbox.run(self._file_writer(target))
                except SandboxViolation:
                    self.fail("Could not create gen_py file due to SandboxViolation")
            finally:
                if os.path.exists(target): os.remove(target)
test_sandbox.py 文件源码 项目:flasky 作者: RoseOu 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def test_win32com(self):
            """
            win32com should not be prevented from caching COM interfaces
            in gen_py.
            """
            import win32com
            gen_py = win32com.__gen_path__
            target = os.path.join(gen_py, 'test_write')
            sandbox = DirectorySandbox(self.dir)
            try:
                try:
                    sandbox.run(self._file_writer(target))
                except SandboxViolation:
                    self.fail("Could not create gen_py file due to SandboxViolation")
            finally:
                if os.path.exists(target): os.remove(target)
test_sandbox.py 文件源码 项目:chihu 作者: yelongyu 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def test_win32com(self):
            """
            win32com should not be prevented from caching COM interfaces
            in gen_py.
            """
            import win32com
            gen_py = win32com.__gen_path__
            target = os.path.join(gen_py, 'test_write')
            sandbox = DirectorySandbox(self.dir)
            try:
                try:
                    sandbox.run(self._file_writer(target))
                except SandboxViolation:
                    self.fail("Could not create gen_py file due to SandboxViolation")
            finally:
                if os.path.exists(target): os.remove(target)
test_sandbox.py 文件源码 项目:Price-Comparator 作者: Thejas-1 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def test_win32com(self):
            """
            win32com should not be prevented from caching COM interfaces
            in gen_py.
            """
            import win32com
            gen_py = win32com.__gen_path__
            target = os.path.join(gen_py, 'test_write')
            sandbox = DirectorySandbox(self.dir)
            try:
                try:
                    sandbox.run(self._file_writer(target))
                except SandboxViolation:
                    self.fail("Could not create gen_py file due to SandboxViolation")
            finally:
                if os.path.exists(target): os.remove(target)
test_sandbox.py 文件源码 项目:Flask-NvRay-Blog 作者: rui7157 项目源码 文件源码 阅读 58 收藏 0 点赞 0 评论 0
def test_win32com(self):
            """
            win32com should not be prevented from caching COM interfaces
            in gen_py.
            """
            import win32com
            gen_py = win32com.__gen_path__
            target = os.path.join(gen_py, 'test_write')
            sandbox = DirectorySandbox(self.dir)
            try:
                try:
                    sandbox.run(self._file_writer(target))
                except SandboxViolation:
                    self.fail("Could not create gen_py file due to SandboxViolation")
            finally:
                if os.path.exists(target): os.remove(target)
test_sandbox.py 文件源码 项目:NeuroMobile 作者: AndrewADykman 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def test_win32com(self):
            """
            win32com should not be prevented from caching COM interfaces
            in gen_py.
            """
            import win32com
            gen_py = win32com.__gen_path__
            target = os.path.join(gen_py, 'test_write')
            sandbox = DirectorySandbox(self.dir)
            try:
                try:
                    sandbox.run(self._file_writer(target))
                except SandboxViolation:
                    self.fail("Could not create gen_py file due to SandboxViolation")
            finally:
                if os.path.exists(target): os.remove(target)
test_sandbox.py 文件源码 项目:dymo-m10-python 作者: pbrf 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def test_win32com(self):
            """
            win32com should not be prevented from caching COM interfaces
            in gen_py.
            """
            import win32com
            gen_py = win32com.__gen_path__
            target = os.path.join(gen_py, 'test_write')
            sandbox = DirectorySandbox(self.dir)
            try:
                try:
                    sandbox.run(self._file_writer(target))
                except SandboxViolation:
                    self.fail("Could not create gen_py file due to SandboxViolation")
            finally:
                if os.path.exists(target): os.remove(target)
test_sandbox.py 文件源码 项目:kbe_server 作者: xiaohaoppy 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def test_win32com(self):
            """
            win32com should not be prevented from caching COM interfaces
            in gen_py.
            """
            import win32com
            gen_py = win32com.__gen_path__
            target = os.path.join(gen_py, 'test_write')
            sandbox = DirectorySandbox(self.dir)
            try:
                try:
                    sandbox.run(self._file_writer(target))
                except SandboxViolation:
                    self.fail("Could not create gen_py file due to SandboxViolation")
            finally:
                if os.path.exists(target): os.remove(target)
test_sandbox.py 文件源码 项目:micro-blog 作者: nickChenyx 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def test_win32com(self):
            """
            win32com should not be prevented from caching COM interfaces
            in gen_py.
            """
            import win32com
            gen_py = win32com.__gen_path__
            target = os.path.join(gen_py, 'test_write')
            sandbox = DirectorySandbox(self.dir)
            try:
                try:
                    sandbox.run(self._file_writer(target))
                except SandboxViolation:
                    self.fail("Could not create gen_py file due to SandboxViolation")
            finally:
                if os.path.exists(target): os.remove(target)
test_sandbox.py 文件源码 项目:browser_vuln_check 作者: lcatro 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def test_sandbox_violation_raised_hiding_setuptools(self, tmpdir):
        """
        When in a sandbox with setuptools hidden, a SandboxViolation
        should reflect a proper exception and not be wrapped in
        an UnpickleableException.
        """
        def write_file():
            "Trigger a SandboxViolation by writing outside the sandbox"
            with open('/etc/foo', 'w'):
                pass
        sandbox = DirectorySandbox(str(tmpdir))
        with pytest.raises(setuptools.sandbox.SandboxViolation) as caught:
            with setuptools.sandbox.save_modules():
                setuptools.sandbox.hide_setuptools()
                sandbox.run(write_file)

        cmd, args, kwargs = caught.value.args
        assert cmd == 'open'
        assert args == ('/etc/foo', 'w')
        assert kwargs == {}
test_sandbox.py 文件源码 项目:Alfred 作者: jkachhadia 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def test_win32com(self):
            """
            win32com should not be prevented from caching COM interfaces
            in gen_py.
            """
            import win32com
            gen_py = win32com.__gen_path__
            target = os.path.join(gen_py, 'test_write')
            sandbox = DirectorySandbox(self.dir)
            try:
                try:
                    sandbox.run(self._file_writer(target))
                except SandboxViolation:
                    self.fail("Could not create gen_py file due to SandboxViolation")
            finally:
                if os.path.exists(target): os.remove(target)
test_sandbox.py 文件源码 项目:BD_T2 作者: jfmolano1587 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def test_win32com(self):
            """
            win32com should not be prevented from caching COM interfaces
            in gen_py.
            """
            import win32com
            gen_py = win32com.__gen_path__
            target = os.path.join(gen_py, 'test_write')
            sandbox = DirectorySandbox(self.dir)
            try:
                try:
                    sandbox.run(self._file_writer(target))
                except SandboxViolation:
                    self.fail("Could not create gen_py file due to SandboxViolation")
            finally:
                if os.path.exists(target): os.remove(target)
test_sandbox.py 文件源码 项目:Flask_Blog 作者: sugarguo 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def test_devnull(self):
        if sys.version < '2.4':
            return
        sandbox = DirectorySandbox(self.dir)
        sandbox.run(self._file_writer(os.devnull))
test_sandbox.py 文件源码 项目:flasky 作者: RoseOu 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def test_devnull(self):
        if sys.version < '2.4':
            return
        sandbox = DirectorySandbox(self.dir)
        sandbox.run(self._file_writer(os.devnull))
test_sandbox.py 文件源码 项目:chihu 作者: yelongyu 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def test_devnull(self):
        if sys.version < '2.4':
            return
        sandbox = DirectorySandbox(self.dir)
        sandbox.run(self._file_writer(os.devnull))
test_sandbox.py 文件源码 项目:Price-Comparator 作者: Thejas-1 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def test_devnull(self):
        if sys.version < '2.4':
            return
        sandbox = DirectorySandbox(self.dir)
        sandbox.run(self._file_writer(os.devnull))
test_sandbox.py 文件源码 项目:Flask-NvRay-Blog 作者: rui7157 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def test_devnull(self):
        if sys.version < '2.4':
            return
        sandbox = DirectorySandbox(self.dir)
        sandbox.run(self._file_writer(os.devnull))
test_sandbox.py 文件源码 项目:NeuroMobile 作者: AndrewADykman 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def test_devnull(self):
        if sys.version < '2.4':
            return
        sandbox = DirectorySandbox(self.dir)
        sandbox.run(self._file_writer(os.devnull))
test_sandbox.py 文件源码 项目:dymo-m10-python 作者: pbrf 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def test_devnull(self):
        if sys.version < '2.4':
            return
        sandbox = DirectorySandbox(self.dir)
        sandbox.run(self._file_writer(os.devnull))
test_sandbox.py 文件源码 项目:Sudoku-Solver 作者: ayush1997 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def test_devnull(self, tmpdir):
        sandbox = DirectorySandbox(str(tmpdir))
        sandbox.run(self._file_writer(os.devnull))
test_sandbox.py 文件源码 项目:Sudoku-Solver 作者: ayush1997 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def test_win32com(self, tmpdir):
        """
        win32com should not be prevented from caching COM interfaces
        in gen_py.
        """
        win32com = pytest.importorskip('win32com')
        gen_py = win32com.__gen_path__
        target = os.path.join(gen_py, 'test_write')
        sandbox = DirectorySandbox(str(tmpdir))
        try:
            # attempt to create gen_py file
            sandbox.run(self._file_writer(target))
        finally:
            if os.path.exists(target):
                os.remove(target)
test_sandbox.py 文件源码 项目:kbe_server 作者: xiaohaoppy 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def test_devnull(self):
        if sys.version < '2.4':
            return
        sandbox = DirectorySandbox(self.dir)
        sandbox.run(self._file_writer(os.devnull))
test_sandbox.py 文件源码 项目:micro-blog 作者: nickChenyx 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def test_devnull(self):
        if sys.version < '2.4':
            return
        sandbox = DirectorySandbox(self.dir)
        sandbox.run(self._file_writer(os.devnull))
test_sandbox.py 文件源码 项目:browser_vuln_check 作者: lcatro 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def test_devnull(self, tmpdir):
        sandbox = DirectorySandbox(str(tmpdir))
        sandbox.run(self._file_writer(os.devnull))
test_sandbox.py 文件源码 项目:browser_vuln_check 作者: lcatro 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def test_win32com(self, tmpdir):
        """
        win32com should not be prevented from caching COM interfaces
        in gen_py.
        """
        win32com = pytest.importorskip('win32com')
        gen_py = win32com.__gen_path__
        target = os.path.join(gen_py, 'test_write')
        sandbox = DirectorySandbox(str(tmpdir))
        try:
            # attempt to create gen_py file
            sandbox.run(self._file_writer(target))
        finally:
            if os.path.exists(target):
                os.remove(target)
test_sandbox.py 文件源码 项目:facebook-face-recognition 作者: mathur 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def test_devnull(self, tmpdir):
        sandbox = DirectorySandbox(str(tmpdir))
        sandbox.run(self._file_writer(os.devnull))
test_sandbox.py 文件源码 项目:facebook-face-recognition 作者: mathur 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def test_win32com(self, tmpdir):
        """
        win32com should not be prevented from caching COM interfaces
        in gen_py.
        """
        win32com = pytest.importorskip('win32com')
        gen_py = win32com.__gen_path__
        target = os.path.join(gen_py, 'test_write')
        sandbox = DirectorySandbox(str(tmpdir))
        try:
            # attempt to create gen_py file
            sandbox.run(self._file_writer(target))
        finally:
            if os.path.exists(target):
                os.remove(target)
test_sandbox.py 文件源码 项目:MyFriend-Rob 作者: lcheniv 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def test_devnull(self, tmpdir):
        sandbox = DirectorySandbox(str(tmpdir))
        sandbox.run(self._file_writer(os.devnull))
test_sandbox.py 文件源码 项目:MyFriend-Rob 作者: lcheniv 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def test_win32com(self, tmpdir):
        """
        win32com should not be prevented from caching COM interfaces
        in gen_py.
        """
        win32com = pytest.importorskip('win32com')
        gen_py = win32com.__gen_path__
        target = os.path.join(gen_py, 'test_write')
        sandbox = DirectorySandbox(str(tmpdir))
        try:
            # attempt to create gen_py file
            sandbox.run(self._file_writer(target))
        finally:
            if os.path.exists(target):
                os.remove(target)
test_sandbox.py 文件源码 项目:Alfred 作者: jkachhadia 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def test_devnull(self):
        if sys.version < '2.4':
            return
        sandbox = DirectorySandbox(self.dir)
        sandbox.run(self._file_writer(os.devnull))


问题


面经


文章

微信
公众号

扫码关注公众号