[Patches] [ python-Patches-423224 ] unittest fixture finder

noreply@sourceforge.net noreply@sourceforge.net
Thu, 10 May 2001 21:53:51 -0700


Patches item #423224, was updated on 2001-05-10 21:53
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=423224&group_id=5470

Category: Modules
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Benjamin Saller (bcsaller)
Assigned to: Nobody/Anonymous (nobody)
Summary: unittest fixture finder

Initial Comment:
Some times it is helpful to know the directory that 
tests are being run from so that they can collect 
their test data. If for example you have a parser and 
some test files finding those file reguardless of how 
the test is called is helpful to the test author.

TestCase has been extended to allow for this. When a 
testCase instance needs to find a data file relative 
to itself it can now say

class TestFoo(TestCase):
  def checkFoo(self):   
   dirname = self.getPath()
   # or
   filename = self.getPath("foo.data")

If TestFoo.py is in /home/user/python/tests then
dirname == /home/user/python/tests 
and 
filename == /home/user/python/tests/foo.data


There is not cost if this feature is not invoked.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=423224&group_id=5470