Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1764 (closed enhancement: fixed)

Opened 11 years ago

Last modified 10 years ago

[PATCH] Add SQLAlchemy support to testutil.DBTest

Reported by: lmacken Owned by: kskuhlman
Priority: low Milestone: 1.1b2
Component: TurboGears Version: 1.1 HEAD
Severity: minor Keywords: needs documentation
Cc: mramm

Description

The attached patch adds SQLAlchemy support to the testutil.DBTest class.

Attachments

TurboGears-1.0-DBTest-SQLAlchemy.patch Download (1.6 KB) - added by lmacken 11 years ago.
TurboGears-1.1-DBTest-SQLAlchemy.patch Download (2.2 KB) - added by lmacken 11 years ago.
An updated patch that doesn't wipe out our child classes setUp/tearDown methods in init
TurboGears-1.5-DBTest-SQLAlchemy.patch Download (2.2 KB) - added by kvdb 11 years ago.
r1764.ken.patch Download (2.3 KB) - added by kskuhlman 11 years ago.
Modified version to make classes discoverable by automated doc utils
dbwebtest.py Download (413 bytes) - added by kvdb 11 years ago.
It's not a patch, just some code.

Change History

Changed 11 years ago by lmacken

comment:1 Changed 11 years ago by lmacken

  • Status changed from new to assigned
  • Owner changed from mramm to lmacken
  • Summary changed from Add SQLAlchemy support to testutil.DBTest to [PATCH] Add SQLAlchemy support to testutil.DBTest

comment:2 Changed 11 years ago by lmacken

  • Cc mramm added

comment:3 Changed 11 years ago by Chris Arndt

  • Version changed from 0.5 to 1.0.4.4

Changed 11 years ago by lmacken

An updated patch that doesn't wipe out our child classes setUp/tearDown methods in init

comment:4 Changed 11 years ago by kvdb

This patch helped me quite a lot! Thanks!

Updated the patch for TG 1.5. [config.get -> turbogears.config.server.get]

Any reason the patch hasn't been applied in any branches yet? All 338 unittests run fine.

Changed 11 years ago by kvdb

comment:5 Changed 11 years ago by kskuhlman

  • Owner changed from lmacken to kskuhlman
  • Status changed from assigned to new

comment:6 Changed 11 years ago by Chris Arndt

While we should definitely have better SA support in testutils, I don't like the idea of detecting the ORM to use in the setUp/tearDown methods via the dburi setting. Why not just provide a separate DBTest subclasses for each ORM, so that test authors can select what they need?

Changed 11 years ago by kskuhlman

Modified version to make classes discoverable by automated doc utils

comment:7 Changed 11 years ago by kskuhlman

  • Status changed from new to assigned

I've attached a patch that should meet the original objective as well as address Chris' concerns, as well as be discoverable to automated API documentation tools. I'd be interested in your feedback. Luke & kvdb, please confirm that it meets your needs & I'll commit it.

Please note that this change should not be considered API stable until it's been documented, unit tested (preferably in test_testutil), and confirmed to be forwards compatible with TG 2.0.

That said, it's a very, very useful idea, so thanks for the contribution!

comment:8 Changed 11 years ago by kvdb

A clean 1.5 branch checkout (r5198) with applied patch r1764.ken.patch needed 2 small modifications for me (config.get -> turbogears.config.server.get). I tested the SA bit, and it works.

So, please commit.

On a related note, you might also want to commit the attached dbwebtest patch. I found that code somewhere in trac (it's not mine), and use it quite a lot.

Changed 11 years ago by kvdb

It's not a patch, just some code.

comment:9 Changed 11 years ago by faide

  • Milestone changed from 1.5 to 1.1

comment:10 Changed 11 years ago by kskuhlman

  • Priority changed from normal to low
  • Version changed from 1.0.4.4 to 1.1 HEAD
  • Severity changed from normal to minor

Committed that code in r5277. kvdb, I'm going to turn you down for now, since I'm not 100% sold on it's general utility. If you feel passionate about it, let's discuss on the mailing list.

Leaving ticket open so we don't forget the documentation issues I cited earlier.

comment:11 Changed 11 years ago by Chris Arndt

Please open a new ticket for the documentation issue and close this one, otherwise it gets really confusing to have lots of open tickets that are already implemented.

(Ideally you would provide the documentation together with the patch :) .)

comment:12 Changed 11 years ago by Chris Arndt

  • Keywords needs documentation added
  • Milestone changed from 1.1 to 1.1 beta 2

comment:13 Changed 10 years ago by faide

  • Status changed from assigned to closed
  • Resolution set to fixed

Created a new ticket for the documentation task referencing this one. Closing.

Note: See TracTickets for help on using tickets.