1 Star 0 Fork 0

yenmuse/comtypes

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
test_pip_install.py 1.75 KB
一键复制 编辑 原始数据 按行查看 历史
Vasily Ryabov 提交于 2018-07-30 21:15 . Fit into 120 symbols.
"""This test covers 'pip install' issue #155"""
import os
import sys
import shutil
import subprocess
import unittest
def read_version():
# Determine the version number by reading it from the file
# 'comtypes\__init__.py'. We cannot import this file (with py3,
# at least) because it is in py2.x syntax.
for line in open("comtypes/__init__.py"):
if line.startswith("__version__ = "):
var, value = line.split('=')
return value.strip().strip('"').strip("'")
raise NotImplementedError("__version__ is not found in __init__.py")
class TestPipInstall(unittest.TestCase):
def setUp(self):
"""prepare the same package that is usually uploaded to PyPI"""
subprocess.check_call([sys.executable, 'setup.py', 'sdist', '--format=zip'])
filename_for_upload = 'comtypes-%s.zip' % read_version()
self.target_package = os.path.join(os.getcwd(), 'dist', filename_for_upload)
self.pip_exe = os.path.join(os.path.dirname(sys.executable), 'Scripts', 'pip.exe')
def test_pip_install(self):
"""Test that "pip install comtypes-x.y.z.zip" works"""
subprocess.check_call([self.pip_exe, 'install', self.target_package])
def test_no_cache_dir_custom_location(self):
"""Test that 'pip install comtypes-x.y.z.zip --no-cache-dir --target="...\custom location"' works"""
custom_dir = os.path.join(os.getcwd(), 'custom location')
if os.path.exists(custom_dir):
shutil.rmtree(custom_dir)
os.makedirs(custom_dir)
# this test catches issue #158
subprocess.check_call('{0} install {1} --no-cache-dir --target="{2}"' \
''.format(self.pip_exe, self.target_package, custom_dir))
if __name__ == '__main__':
unittest.main()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/yenmuse/comtypes.git
git@gitee.com:yenmuse/comtypes.git
yenmuse
comtypes
comtypes
master

搜索帮助