Mercurial > hg > simpypi
diff tests/doctest.txt @ 55:143adebe4caa
install package in a virtualenv and make sure importing is sane
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 01 Mar 2012 15:28:34 -0800 |
parents | 73e6956c670a |
children | 6bfe6c59b64a |
line wrap: on
line diff
--- a/tests/doctest.txt Thu Mar 01 15:04:27 2012 -0800 +++ b/tests/doctest.txt Thu Mar 01 15:28:34 2012 -0800 @@ -7,6 +7,7 @@ >>> import pkginfo >>> import shutil >>> import simpypi + >>> import subprocess >>> import tarfile >>> import tempfile >>> from paste.fixture import TestApp @@ -48,7 +49,7 @@ >>> sdist.author 'Jeff Hammel' -Install the package and inspect the installation:: +Unpack the archive and ensure the files are there:: >>> tmpdir = tempfile.mkdtemp() >>> archive = tarfile.TarFile.open(path) @@ -63,6 +64,30 @@ True >>> os.listdir(os.path.join(srcdir, 'helloworld')) ['__init__.py'] + +Install the package and inspect the installation:: + + >>> python = create_virtualenv(tmpdir) + +You should not be able to import ``helloworld`` yet:: + + >>> code = subprocess.call([python, '-c', 'import helloworld'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + >>> code + 1 + +But after installation you should:: + + >>> subprocess.call([python, 'setup.py', 'install'], cwd=srcdir, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + 0 + >>> code = subprocess.call([python, '-c', 'import helloworld'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + >>> code + 0 + >>> process = subprocess.Popen([python, '-c', 'import helloworld; print helloworld.hello'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + >>> stdout, stderr = process.communicate() + >>> process.returncode + 0 + >>> stdout + 'Hello, world!\n' >>> shutil.rmtree(tmpdir) Upload the same package but with the wrong name::