Re: [SQLObject] Database exceptions handling
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Oleg B. <ph...@ma...> - 2006-07-31 09:43:48
|
On Mon, Jul 31, 2006 at 11:32:21AM +0300, Mircea Amarascu wrote: > However, I found it useful to mark such an event in SQLObject with a > specific exception, > dberrors.DuplicateEntryError This is exactly the point! I'd like to have a broader (comparing to DB API 2.0) set of exceptions. Implementing them will have an additional benefit - Ian Bicking being an active member of db-sig could point to the implementation and use it as a base in the discussion of DB API 3.0. Let us think of it. A client does: 1) connects to a backend; 2) authenticates itself; 3) authorizes to the desired database; 4) runs queries; 5) disconnects. At any stage there is a chance of error: 1) cannot connect to the server (there is no server, firewall, etc.); 2) cannot authenticate (bad credentials); 3) cannot authorize (the client does not have rights for the database); 4) all kinds of exceptions - syntax error, duplicate error, etc.; 5) unexpected disconnect during query. > > SQLObject's tests (based on py.test framework) allow one to limit > > platforms the tests are running on, so you can limit your tests to SQLite > > and MySQL. > > > Could you please briefly explain what needs to be done in order to add a > test in SQLObjects' test > suite? SQLObject tests are very simple - just scripts named "test_*.py" in the directory "test" with a number of functions named "test*". Either the function succeed of raise an exception, usually AssertionError. To test if a call raises an exception there is function raises(). Look into the directory sqlobject/tests... Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |