Re: [Modeling-users] tests/run.py raises error if no postgres adaptor is installed
Status: Abandoned
Brought to you by:
sbigaret
From: Sebastien B. <sbi...@us...> - 2004-03-17 07:19:38
|
"Ernesto Revilla" <er...@si...> wrote: > Hi, >=20 > under python 2.3 with sqlite adaptor installed but no postgres I got this= when running Modeling/tests/run.py: >=20 > Modeling.Adaptor.GeneralAdaptorException: Unable to find either psycopg, = pgdb or pypgsql >=20 Right, we can consider this as a bug: the absence of underlying py adaptor for PostgresqlAdaptor shouldn't raise a fatal error (maybe just a warning) until it is really needed --which is not the case at import time. If you find some time, please submit a bug report at sf. You'll find attached a quick-n-dirty patch. Thanks for reporting! -- S=E9bastien. Index: test_SchemaGeneration.py =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_SchemaGener= ation.py,v retrieving revision 1.6 diff -u -r1.6 test_SchemaGeneration.py --- test_SchemaGeneration.py 14 Feb 2004 18:17:21 -0000 1.6 +++ test_SchemaGeneration.py 17 Mar 2004 06:48:36 -0000 @@ -62,6 +62,11 @@ modelSet=3DModelSet.ModelSet() modelSet.addModelFromXML({'file': xmlmodelPath}) model=3DmodelSet.modelNamed('simpleModel1') + try: + import psycopg + except ImportError: + import sys + sys.modules['psycopg']=3D1 pgAdaptor=3DAdaptor.adaptorWithModel(model) =20 class TestSchemaGeneration(unittest.TestCase): |