Lycovian <mfwil...@gmail.com> wrote:
> How do I import the sqlachemy.testing.suite inside of IPython? I'm trying to > write my own tests for a custom dialect and at the command line and I want to > play with the test suite to learn how it works better. Is it possible to > import it outside of py.test? If so can I get an example of how to load it. > In particular I'm trying to figure out how to subclass the BooleanTest class > of test_types.py. > > > etl@ichabod:~/src/etl/sqlalchemy_teradata$ python -c "import sqlalchemy; > print sqlalchemy.__version__; from sqlalchemy.testing.suite import *" > 1.0.0 > Traceback (most recent call last): > File "<string>", line 1, in <module> > File "/home/etl/build/sqlalchemy/lib/sqlalchemy/testing/suite/__init__.py", > line 2, in <module> > from sqlalchemy.testing.suite.test_ddl import * > File "/home/etl/build/sqlalchemy/lib/sqlalchemy/testing/suite/test_ddl.py", > line 10, in <module> > class TableDDLTest(fixtures.TestBase): > File "/home/etl/build/sqlalchemy/lib/sqlalchemy/testing/suite/test_ddl.py", > line 36, in TableDDLTest > @requirements.create_table > AttributeError: 'NoneType' object has no attribute ‘create_table' I can see that that’s not working right now, though the test suite relies heavily, moreso when it actually runs than when it first imports, on configurational things that are set up by the plugin system in sqlalchemy/testing/plugin; namely the configuration which includes available database engines and so-forth, as well as access to the “requirements” system which is dynamically loaded up as well by that same system. Basically I could get those requirements imports to “work” in a vanilla import scenario like above, but then a lot of other things aren’t going to work, namely being able to run most tests :). It would be nice if the whole test suite knew how to do a unittest-style “everything just works” with simple imports, but the things the test suite does with database configurations, plugins, and actually pretty importantly deferring all imports of sqlalchemy until coverage is set up, is pretty elaborate and it might be difficult to keep that particular mode of usage in service, if one were devised. running with py.test or nose, you can get into the code easily using pdb. That’s how I move around when I want to poke at things in the context of a running test. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.