# HG changeset patch # User Marc Abramowitz # Date 2015-04-08 01:21:12 # Node ID 07dbfabb8fea8a11dbf5963c84debc1ccdfb64bc # Parent 8b90694580aba83e633daacdaf319efa923be19e 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 diff --git a/kallithea/tests/conftest.py b/kallithea/tests/conftest.py new file mode 100644 --- /dev/null +++ b/kallithea/tests/conftest.py @@ -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