changeset 5001:07dbfabb8fea

tests: Add conftest.py for pytest This adds a conftest.py for pytest that initializes the Pylons app so that the SQLAlchemy session is bound and such. This is sort of the Python analogue for the nosetest plugin that Pylons includes: https://github.com/Pylons/pylons/blob/master/pylons/test.py
author Marc Abramowitz <marc@marc-abramowitz.com>
date Tue, 07 Apr 2015 16:21:12 -0700
parents 8b90694580ab
children 1931d4e37fc2
files kallithea/tests/conftest.py
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kallithea/tests/conftest.py	Tue Apr 07 16:21:12 2015 -0700
@@ -0,0 +1,14 @@
+import os
+import sys
+
+import pkg_resources
+from paste.deploy import loadapp
+import pylons.test
+
+
+def pytest_configure():
+    path = os.getcwd()
+    sys.path.insert(0, path)
+    pkg_resources.working_set.add_entry(path)
+    pylons.test.pylonsapp = loadapp('config:test.ini', relative_to=path)
+    return pylons.test.pylonsapp