[open-ils-commits] r8188 - trunk/build/i18n/tests

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Dec 10 09:10:24 EST 2007


Author: dbs
Date: 2007-12-10 08:50:04 -0500 (Mon, 10 Dec 2007)
New Revision: 8188

Modified:
   trunk/build/i18n/tests/testIDL.py
   trunk/build/i18n/tests/testbase.py
Log:
Remove relative path dependencies for running tests.


Modified: trunk/build/i18n/tests/testIDL.py
===================================================================
--- trunk/build/i18n/tests/testIDL.py	2007-12-10 02:23:11 UTC (rev 8187)
+++ trunk/build/i18n/tests/testIDL.py	2007-12-10 13:50:04 UTC (rev 8188)
@@ -17,18 +17,20 @@
 
 class TestIDLL10N(unittest.TestCase):
 
-    tmpdirs = [('tmp/')]
-    savepot = 'tmp/testsave.pot'
-    saveidlent = 'tmp/testidlent.xml'
-    saveentities = 'tmp/testentity.ent'
-    idlfile = 'data/testidl.xml'
-    idlentfile = 'data/testidlent.xml'
-    idlentities = 'data/testidl.ent'
-    testpot = 'data/testidl.pot'
-    testpo = 'data/testidl.po'
+    basedir = os.path.dirname(__file__)
+    script = os.path.join(basedir, '../scripts/fieldmapper.py')
+    tmpdirs = [(os.path.join(basedir, 'tmp/'))]
+    savepot = os.path.join(basedir, 'tmp/testsave.pot')
+    saveidlent = os.path.join(basedir, 'tmp/testidlent.xml')
+    saveentities = os.path.join(basedir, 'tmp/testentity.ent')
+    idlfile = os.path.join(basedir, 'data/testidl.xml')
+    idlentfile = os.path.join(basedir, 'data/testidlent.xml')
+    idlentities = os.path.join(basedir, 'data/testidl.ent')
+    testpot = os.path.join(basedir, 'data/testidl.pot')
+    testpo = os.path.join(basedir, 'data/testidl.po')
 
     def setUp(self):
-        sys.path.append('../scripts/')
+        sys.path.append(os.path.join(self.basedir, '../scripts/'))
         self.tearDown()
         for dir in self.tmpdirs:
             os.mkdir(dir)
@@ -46,7 +48,7 @@
         """
         devnull = open('/dev/null', 'w')
         proc = subprocess.Popen(
-            ('python', '../scripts/fieldmapper.py', '--convert', self.idlfile,
+            ('python', self.script, '--convert', self.idlfile,
             '--output', self.saveidlent),
             0, None, None, devnull, devnull).wait()
 
@@ -58,7 +60,7 @@
         """
         devnull = open('/dev/null', 'w')
         proc = subprocess.Popen(
-            ('python', '../scripts/fieldmapper.py', '--pot', self.idlfile,
+            ('python', self.script, '--pot', self.idlfile,
             '--output', self.savepot),
             0, None, None, devnull, devnull).wait()
 
@@ -73,7 +75,7 @@
         """
         devnull = open('/dev/null', 'w')
         proc = subprocess.Popen(
-            ('python', '../scripts/fieldmapper.py', '--entity', self.testpo,
+            ('python', self.script, '--entity', self.testpo,
             '--output', self.saveentities),
             0, None, None, devnull, devnull).wait()
         self.assertEqual(filecmp.cmp(self.saveentities, self.idlentities), 1)

Modified: trunk/build/i18n/tests/testbase.py
===================================================================
--- trunk/build/i18n/tests/testbase.py	2007-12-10 02:23:11 UTC (rev 8187)
+++ trunk/build/i18n/tests/testbase.py	2007-12-10 13:50:04 UTC (rev 8188)
@@ -12,10 +12,11 @@
 
 class TestBaseL10N(unittest.TestCase):
 
-    tmpdirs = [('tmp/')]
-    savefile = ('tmp/testsave.pot')
-    canonpot = ('data/complex.pot')
-    canonpo = ('data/complex.po')
+    basedir = os.path.dirname(__file__)
+    tmpdirs = [(os.path.join(basedir, 'tmp/'))]
+    savefile = os.path.join(basedir, 'tmp/testsave.pot')
+    canonpot = os.path.join(basedir, 'data/complex.pot')
+    canonpo = os.path.join(basedir, 'data/complex.po')
     poentries = [{
         'msgid': 'Using Library', 
         'msgstr': 'Utiliser la bibliothèque',
@@ -37,7 +38,7 @@
     ]
 
     def setUp(self):
-        sys.path.append('../scripts/')
+        sys.path.append(os.path.join(self.basedir, '../scripts/'))
         self.tearDown()
         for dir in self.tmpdirs:
             os.mkdir(dir)



More information about the open-ils-commits mailing list