From dbed163ccebc9c45d9efc2fbb2502ecba4ab8773 Mon Sep 17 00:00:00 2001 From: Jason Kirtland Date: Fri, 23 Apr 2010 12:16:58 -0700 Subject: [PATCH] Make sqla_nose.py "just work" for running tests on checkouts without a setup.py develop step or PYTHONPATH. --- sqla_nose.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) mode change 100644 => 100755 sqla_nose.py 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()]) - -- 2.47.2