SF.net SVN: fclient: [223] trunk/sandbox/fcp/test_fcp/test_fcp2_0_client.py
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <ju...@us...> - 2008-02-17 09:21:22
|
Revision: 223
http://fclient.svn.sourceforge.net/fclient/?rev=223&view=rev
Author: jurner
Date: 2008-02-17 01:21:27 -0800 (Sun, 17 Feb 2008)
Log Message:
-----------
new sys path hack
Modified Paths:
--------------
trunk/sandbox/fcp/test_fcp/test_fcp2_0_client.py
Modified: trunk/sandbox/fcp/test_fcp/test_fcp2_0_client.py
===================================================================
--- trunk/sandbox/fcp/test_fcp/test_fcp2_0_client.py 2008-02-17 09:20:13 UTC (rev 222)
+++ trunk/sandbox/fcp/test_fcp/test_fcp2_0_client.py 2008-02-17 09:21:27 UTC (rev 223)
@@ -9,12 +9,13 @@
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)
import fcp2_0_client
@@ -22,8 +23,7 @@
import fcp2_0_consts as consts
-sys.path.pop(0)
-del parentdir
+del hack
#<-- rel import hack
from dummy_socket import DummySocket
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|