From: Jason Kirtland Date: Fri, 23 Apr 2010 19:16:58 +0000 (-0700) Subject: Make sqla_nose.py "just work" for running tests on checkouts without a setup.py devel... X-Git-Tag: rel_0_6_1~37 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dbed163ccebc9c45d9efc2fbb2502ecba4ab8773;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Make sqla_nose.py "just work" for running tests on checkouts without a setup.py develop step or PYTHONPATH. --- diff --git a/sqla_nose.py b/sqla_nose.py old mode 100644 new mode 100755 index 0542b4e5dd..32604f97c6 --- a/sqla_nose.py +++ b/sqla_nose.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python """ nose runner script. @@ -6,17 +7,23 @@ on Python 3K. Otherwise consult README.unittests for the recommended methods of running tests. """ +try: + import sqlalchemy +except ImportError: + from os import path + import sys + sys.path.append(path.join(path.dirname(__file__), 'lib')) import nose from sqlalchemy.test.noseplugin import NoseSQLAlchemy from sqlalchemy.util import py3k + if __name__ == '__main__': if py3k: - # this version breaks verbose output, + # this version breaks verbose output, # but is the only API that nose3 currently supports nose.main(plugins=[NoseSQLAlchemy()]) else: # this is the "correct" API nose.main(addplugins=[NoseSQLAlchemy()]) -