From: <ju...@us...> - 2008-02-17 09:21:37
|
Revision: 224 http://fclient.svn.sourceforge.net/fclient/?rev=224&view=rev Author: jurner Date: 2008-02-17 01:21:42 -0800 (Sun, 17 Feb 2008) Log Message: ----------- new sys path hack Modified Paths: -------------- trunk/sandbox/fcp/test_fcp/test_fcp2_0_message.py Modified: trunk/sandbox/fcp/test_fcp/test_fcp2_0_message.py =================================================================== --- trunk/sandbox/fcp/test_fcp/test_fcp2_0_message.py 2008-02-17 09:21:27 UTC (rev 223) +++ trunk/sandbox/fcp/test_fcp/test_fcp2_0_message.py 2008-02-17 09:21:42 UTC (rev 224) @@ -5,20 +5,20 @@ import unittest #--> rel import hack -def parentdir(n, fpath): - fpath = os.path.abspath(fpath) - for i in xrange(n): - fpath = os.path.dirname(fpath) - return fpath -sys.path.insert(0, parentdir(2, __file__)) +class SysPathHack(object): + def __init__(self, n): + fpath = os.path.abspath(__file__) + for i in xrange(n): fpath = os.path.dirname(fpath) + sys.path.insert(0, fpath) + def __del__(self): sys.path.pop(0) +hack = SysPathHack(2) from fcp2_0_client import FcpClient Message = FcpClient.Message import fcp2_0_consts as consts -sys.path.pop(0) -del parentdir +del hack #<-- rel import hack This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |