本文整理汇总了Python中pex.pex.PEX.site_libs方法的典型用法代码示例。如果您正苦于以下问题:Python PEX.site_libs方法的具体用法?Python PEX.site_libs怎么用?Python PEX.site_libs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pex.pex.PEX
的用法示例。
在下文中一共展示了PEX.site_libs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_site_libs
# 需要导入模块: from pex.pex import PEX [as 别名]
# 或者: from pex.pex.PEX import site_libs [as 别名]
def test_site_libs():
with nested(mock.patch.object(PEX, '_get_site_packages'), temporary_dir()) as (
mock_site_packages, tempdir):
site_packages = os.path.join(tempdir, 'site-packages')
os.mkdir(site_packages)
mock_site_packages.return_value = set([site_packages])
site_libs = PEX.site_libs()
assert site_packages in site_libs
示例2: test_site_libs_excludes_prefix
# 需要导入模块: from pex.pex import PEX [as 别名]
# 或者: from pex.pex.PEX import site_libs [as 别名]
def test_site_libs_excludes_prefix():
"""Windows returns sys.prefix as part of getsitepackages(). Make sure to exclude it."""
with nested(mock.patch.object(PEX, '_get_site_packages'), temporary_dir()) as (
mock_site_packages, tempdir):
site_packages = os.path.join(tempdir, 'site-packages')
os.mkdir(site_packages)
mock_site_packages.return_value = set([site_packages, sys.prefix])
site_libs = PEX.site_libs()
assert site_packages in site_libs
assert sys.prefix not in site_libs
示例3: test_site_libs_symlink
# 需要导入模块: from pex.pex import PEX [as 别名]
# 或者: from pex.pex.PEX import site_libs [as 别名]
def test_site_libs_symlink():
with nested(mock.patch.object(PEX, '_get_site_packages'), temporary_dir()) as (
mock_site_packages, tempdir):
site_packages = os.path.join(tempdir, 'site-packages')
os.mkdir(site_packages)
site_packages_link = os.path.join(tempdir, 'site-packages-link')
os.symlink(site_packages, site_packages_link)
mock_site_packages.return_value = set([site_packages_link])
site_libs = PEX.site_libs()
assert os.path.realpath(site_packages) in site_libs
assert site_packages_link in site_libs