Commits

Maciej Fijalkowski committed 040c709

abomination. add virtualenv level tests

Comments (0)

Files changed (3)

testing/snippets/infrastructure/setup.py

+
+from distutils.core import setup
+
+setup(packages=['snip_infrastructure'],
+      requires=['cffi'])

testing/snippets/infrastructure/snip_infrastructure/__init__.py

+
+def func():
+    return 42

testing/test_integration.py

+
+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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.