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 #1684 (closed defect: wontfix)

Opened 12 years ago

Last modified 11 years ago

Add some simple test helpers

Reported by: mramm Owned by: anonymous
Priority: normal Milestone:
Component: TurboGears Version: trunk
Severity: normal Keywords:
Cc:

Description

Here's some user-contributed code.

     def setUp(self):
         from sqlalchemy import create_engine
         engine = create_engine('sqlite:///', echo=True)
         model.metadata.bind = engine
         model.metadata.create_all()
         TestCase.setUp(self)
         
     def tearDown(self):
         model.metadata.drop_all()
         TestCase.tearDown(self)
     
     def _do_request(self, url, method='GET', **kwargs):
         methods = {
             'GET': self.app.get,
             'POST': self.app.post,
         }
         return methods.get(method, self.app.get)(url, **kwargs)
     
     def get(self, url, **kwargs):
         return self._do_request(url, 'GET', **kwargs)
     
     def post(self, url, **kwargs):
         return self._do_request(url, 'POST', **kwargs)

]]]

We could just add this to the test setup for the quickstarted project, but we should probably use the engine setup by test.ini.  And I think we should leverage as much of the pylons test infrastructure as possible:

http://wiki.pylonshq.com/display/pylonsdocs/Unit+Testing

Change History

comment:1 Changed 12 years ago by max

There is not much to leverage. Also, I'd strongly prefer having the helpers in TG2 or Pylons codebase instead of quickstarted projects so that user has less code to maintain.

comment:2 Changed 12 years ago by mramm

Agreed, we should probably create a testutil type module for tg2.

comment:3 Changed 12 years ago by mramm

  • Milestone changed from 2.0 to 2.0-preview

comment:4 Changed 11 years ago by mramm

Anybody know why Pylons uses the nose extension rather than just using a custom setup function?

comment:5 Changed 11 years ago by mramm

  • Status changed from new to closed
  • Resolution set to wontfix

We just need to make the testutil class work like 1.1.

comment:6 Changed 11 years ago by anonymous

  • Milestone 2.0-preview-1 deleted

Milestone 2.0-preview-1 deleted

Note: See TracTickets for help on using tickets.