python类CommandSpec()的实例源码

test_easy_install.py 文件源码 项目:Sudoku-Solver 作者: ayush1997 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def test_get_script_args(self):
        header = ei.CommandSpec.best().from_environment().as_header()
        expected = header + DALS("""
            # EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name'
            __requires__ = 'spec'
            import sys
            from pkg_resources import load_entry_point

            if __name__ == '__main__':
                sys.exit(
                    load_entry_point('spec', 'console_scripts', 'name')()
                )
            """)
        dist = FakeDist()

        args = next(ei.ScriptWriter.get_args(dist))
        name, script = itertools.islice(args, 2)

        assert script == expected
test_easy_install.py 文件源码 项目:setuptools 作者: pypa 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def test_get_script_args(self):
        header = ei.CommandSpec.best().from_environment().as_header()
        expected = header + DALS(r"""
            # EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name'
            __requires__ = 'spec'
            import re
            import sys
            from pkg_resources import load_entry_point

            if __name__ == '__main__':
                sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
                sys.exit(
                    load_entry_point('spec', 'console_scripts', 'name')()
                )
            """)
        dist = FakeDist()

        args = next(ei.ScriptWriter.get_args(dist))
        name, script = itertools.islice(args, 2)

        assert script == expected
test_easy_install.py 文件源码 项目:browser_vuln_check 作者: lcatro 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def test_get_script_args(self):
        header = ei.CommandSpec.best().from_environment().as_header()
        expected = header + DALS("""
            # EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name'
            __requires__ = 'spec'
            import re
            import sys
            from pkg_resources import load_entry_point

            if __name__ == '__main__':
                sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
                sys.exit(
                    load_entry_point('spec', 'console_scripts', 'name')()
                )
            """)
        dist = FakeDist()

        args = next(ei.ScriptWriter.get_args(dist))
        name, script = itertools.islice(args, 2)

        assert script == expected
test_easy_install.py 文件源码 项目:facebook-face-recognition 作者: mathur 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def test_get_script_args(self):
        header = ei.CommandSpec.best().from_environment().as_header()
        expected = header + DALS("""
            # EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name'
            __requires__ = 'spec'
            import sys
            from pkg_resources import load_entry_point

            if __name__ == '__main__':
                sys.exit(
                    load_entry_point('spec', 'console_scripts', 'name')()
                )
            """)
        dist = FakeDist()

        args = next(ei.ScriptWriter.get_args(dist))
        name, script = itertools.islice(args, 2)

        assert script == expected
test_easy_install.py 文件源码 项目:MyFriend-Rob 作者: lcheniv 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def test_get_script_args(self):
        header = ei.CommandSpec.best().from_environment().as_header()
        expected = header + DALS("""
            # EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name'
            __requires__ = 'spec'
            import sys
            from pkg_resources import load_entry_point

            if __name__ == '__main__':
                sys.exit(
                    load_entry_point('spec', 'console_scripts', 'name')()
                )
            """)
        dist = FakeDist()

        args = next(ei.ScriptWriter.get_args(dist))
        name, script = itertools.islice(args, 2)

        assert script == expected
test_easy_install.py 文件源码 项目:Sudoku-Solver 作者: ayush1997 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def test_custom_launch_command(self):
        """
        Show how a custom CommandSpec could be used to specify a #! executable
        which takes parameters.
        """
        cmd = ei.CommandSpec(['/usr/bin/env', 'python3'])
        assert cmd.as_header() == '#!/usr/bin/env python3\n'
test_easy_install.py 文件源码 项目:Sudoku-Solver 作者: ayush1997 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def test_from_param_for_CommandSpec_is_passthrough(self):
        """
        from_param should return an instance of a CommandSpec
        """
        cmd = ei.CommandSpec(['python'])
        cmd_new = ei.CommandSpec.from_param(cmd)
        assert cmd is cmd_new
test_easy_install.py 文件源码 项目:Sudoku-Solver 作者: ayush1997 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def test_from_environment_with_spaces_in_executable(self):
        with mock.patch('sys.executable', TestScriptHeader.exe_with_spaces):
            cmd = ei.CommandSpec.from_environment()
        assert len(cmd) == 1
        assert cmd.as_header().startswith('#!"')
test_easy_install.py 文件源码 项目:Sudoku-Solver 作者: ayush1997 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def test_from_simple_string_uses_shlex(self):
        """
        In order to support `executable = /usr/bin/env my-python`, make sure
        from_param invokes shlex on that input.
        """
        cmd = ei.CommandSpec.from_param('/usr/bin/env my-python')
        assert len(cmd) == 2
        assert '"' not in cmd.as_header()
test_easy_install.py 文件源码 项目:setuptools 作者: pypa 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def test_custom_launch_command(self):
        """
        Show how a custom CommandSpec could be used to specify a #! executable
        which takes parameters.
        """
        cmd = ei.CommandSpec(['/usr/bin/env', 'python3'])
        assert cmd.as_header() == '#!/usr/bin/env python3\n'
test_easy_install.py 文件源码 项目:setuptools 作者: pypa 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def test_from_param_for_CommandSpec_is_passthrough(self):
        """
        from_param should return an instance of a CommandSpec
        """
        cmd = ei.CommandSpec(['python'])
        cmd_new = ei.CommandSpec.from_param(cmd)
        assert cmd is cmd_new
test_easy_install.py 文件源码 项目:setuptools 作者: pypa 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def test_from_environment_with_spaces_in_executable(self):
        os.environ.pop('__PYVENV_LAUNCHER__', None)
        cmd = ei.CommandSpec.from_environment()
        assert len(cmd) == 1
        assert cmd.as_header().startswith('#!"')
test_easy_install.py 文件源码 项目:setuptools 作者: pypa 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def test_from_simple_string_uses_shlex(self):
        """
        In order to support `executable = /usr/bin/env my-python`, make sure
        from_param invokes shlex on that input.
        """
        cmd = ei.CommandSpec.from_param('/usr/bin/env my-python')
        assert len(cmd) == 2
        assert '"' not in cmd.as_header()
test_easy_install.py 文件源码 项目:browser_vuln_check 作者: lcatro 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def test_custom_launch_command(self):
        """
        Show how a custom CommandSpec could be used to specify a #! executable
        which takes parameters.
        """
        cmd = ei.CommandSpec(['/usr/bin/env', 'python3'])
        assert cmd.as_header() == '#!/usr/bin/env python3\n'
test_easy_install.py 文件源码 项目:browser_vuln_check 作者: lcatro 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def test_from_param_for_CommandSpec_is_passthrough(self):
        """
        from_param should return an instance of a CommandSpec
        """
        cmd = ei.CommandSpec(['python'])
        cmd_new = ei.CommandSpec.from_param(cmd)
        assert cmd is cmd_new
test_easy_install.py 文件源码 项目:browser_vuln_check 作者: lcatro 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def test_from_environment_with_spaces_in_executable(self):
        os.environ.pop('__PYVENV_LAUNCHER__', None)
        cmd = ei.CommandSpec.from_environment()
        assert len(cmd) == 1
        assert cmd.as_header().startswith('#!"')
test_easy_install.py 文件源码 项目:browser_vuln_check 作者: lcatro 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def test_from_simple_string_uses_shlex(self):
        """
        In order to support `executable = /usr/bin/env my-python`, make sure
        from_param invokes shlex on that input.
        """
        cmd = ei.CommandSpec.from_param('/usr/bin/env my-python')
        assert len(cmd) == 2
        assert '"' not in cmd.as_header()
test_easy_install.py 文件源码 项目:facebook-face-recognition 作者: mathur 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def test_custom_launch_command(self):
        """
        Show how a custom CommandSpec could be used to specify a #! executable
        which takes parameters.
        """
        cmd = ei.CommandSpec(['/usr/bin/env', 'python3'])
        assert cmd.as_header() == '#!/usr/bin/env python3\n'
test_easy_install.py 文件源码 项目:facebook-face-recognition 作者: mathur 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def test_from_param_for_CommandSpec_is_passthrough(self):
        """
        from_param should return an instance of a CommandSpec
        """
        cmd = ei.CommandSpec(['python'])
        cmd_new = ei.CommandSpec.from_param(cmd)
        assert cmd is cmd_new
test_easy_install.py 文件源码 项目:facebook-face-recognition 作者: mathur 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def test_from_environment_with_spaces_in_executable(self):
        with mock.patch('sys.executable', TestScriptHeader.exe_with_spaces):
            cmd = ei.CommandSpec.from_environment()
        assert len(cmd) == 1
        assert cmd.as_header().startswith('#!"')
test_easy_install.py 文件源码 项目:facebook-face-recognition 作者: mathur 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def test_from_simple_string_uses_shlex(self):
        """
        In order to support `executable = /usr/bin/env my-python`, make sure
        from_param invokes shlex on that input.
        """
        cmd = ei.CommandSpec.from_param('/usr/bin/env my-python')
        assert len(cmd) == 2
        assert '"' not in cmd.as_header()
test_easy_install.py 文件源码 项目:MyFriend-Rob 作者: lcheniv 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def test_custom_launch_command(self):
        """
        Show how a custom CommandSpec could be used to specify a #! executable
        which takes parameters.
        """
        cmd = ei.CommandSpec(['/usr/bin/env', 'python3'])
        assert cmd.as_header() == '#!/usr/bin/env python3\n'
test_easy_install.py 文件源码 项目:MyFriend-Rob 作者: lcheniv 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def test_from_param_for_CommandSpec_is_passthrough(self):
        """
        from_param should return an instance of a CommandSpec
        """
        cmd = ei.CommandSpec(['python'])
        cmd_new = ei.CommandSpec.from_param(cmd)
        assert cmd is cmd_new
test_easy_install.py 文件源码 项目:MyFriend-Rob 作者: lcheniv 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def test_from_environment_with_spaces_in_executable(self):
        with mock.patch('sys.executable', TestScriptHeader.exe_with_spaces):
            cmd = ei.CommandSpec.from_environment()
        assert len(cmd) == 1
        assert cmd.as_header().startswith('#!"')
test_easy_install.py 文件源码 项目:MyFriend-Rob 作者: lcheniv 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def test_from_simple_string_uses_shlex(self):
        """
        In order to support `executable = /usr/bin/env my-python`, make sure
        from_param invokes shlex on that input.
        """
        cmd = ei.CommandSpec.from_param('/usr/bin/env my-python')
        assert len(cmd) == 2
        assert '"' not in cmd.as_header()


问题


面经


文章

微信
公众号

扫码关注公众号