[pypy-commit] cffi default: abomination. add virtualenv level tests
fijal
noreply at buildbot.pypy.org
Thu Sep 20 13:01:17 CEST 2012
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch:
Changeset: r956:040c70906f63
Date: 2012-09-20 13:00 +0200
http://bitbucket.org/cffi/cffi/changeset/040c70906f63/
Log: abomination. add virtualenv level tests
diff --git a/testing/snippets/infrastructure/setup.py b/testing/snippets/infrastructure/setup.py
new file mode 100644
--- /dev/null
+++ b/testing/snippets/infrastructure/setup.py
@@ -0,0 +1,5 @@
+
+from distutils.core import setup
+
+setup(packages=['snip_infrastructure'],
+ requires=['cffi'])
diff --git a/testing/snippets/infrastructure/snip_infrastructure/__init__.py b/testing/snippets/infrastructure/snip_infrastructure/__init__.py
new file mode 100644
--- /dev/null
+++ b/testing/snippets/infrastructure/snip_infrastructure/__init__.py
@@ -0,0 +1,3 @@
+
+def func():
+ return 42
diff --git a/testing/test_integration.py b/testing/test_integration.py
new file mode 100644
--- /dev/null
+++ b/testing/test_integration.py
@@ -0,0 +1,33 @@
+
+import py, sys, os
+import tempfile
+
+class DummyLogger(object):
+ indent = 0
+
+ def __getattr__(self, attr):
+ return lambda *args: None
+
+def create_venv():
+ import virtualenv
+ tmpdir = tempfile.mkdtemp()
+ virtualenv.logger = DummyLogger()
+ virtualenv.create_environment(tmpdir, site_packages=False)
+ tmpdir = py.path.local(tmpdir)
+ execfile(str(tmpdir.join("bin", "activate_this.py")))
+
+SNIPPET_DIR = py.path.local(__file__).join('..', 'snippets')
+
+def test_infrastructure():
+ create_venv()
+ oldargv = sys.argv
+ olddir = os.getcwd()
+ try:
+ os.chdir(str(SNIPPET_DIR.join('infrastructure')))
+ sys.argv = ['setup.py', 'install']
+ execfile(str(SNIPPET_DIR.join('infrastructure', 'setup.py')))
+ finally:
+ sys.argv = oldargv
+ os.chdir(olddir)
+ import snip_infrastructure
+ assert snip_infrastructure.func() == 42
More information about the pypy-commit
mailing list