Skip to content

Commit

Permalink
Add test for "pip install comtypes" (reproduce enthought#155).
Browse files Browse the repository at this point in the history
  • Loading branch information
vasily-v-ryabov committed Jul 5, 2018
1 parent 8729d30 commit cf1a549
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ environment:

test_script:
- C:\%py%\python.exe setup.py install
- C:\%py%\Scripts\pip.exe uninstall comtypes -y
- C:\%py%\python.exe test_pip_install.py
24 changes: 24 additions & 0 deletions test_pip_install.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import os
import sys
import subprocess

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.
ns = {}
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")

# prepare the same package that is usually uploaded to PyPI
subprocess.check_output([sys.executable, 'setup.py', 'sdist', '--format=zip'])

filename_for_upload = 'comtypes-{}.zip'.format(read_version())
target_package = os.path.join(os.getcwd(), 'sdist', filename_for_upload)

# run "pip install comtypes-x.y.z.zip"
pip_exe = os.path.join(os.path.dirname(sys.executable), 'Scripts', 'pip.exe')
subprocess.check_output([pip_exe, 'install', target_package])

0 comments on commit cf1a549

Please sign in to comment.