Remove relative path dependencies for running tests.
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 10 Dec 2007 13:50:04 +0000 (13:50 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 10 Dec 2007 13:50:04 +0000 (13:50 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@8188 dcc99617-32d9-48b4-a31d-7c20da2025e4

build/i18n/tests/testIDL.py
build/i18n/tests/testbase.py

index 3dfaf4f..9d90c9e 100644 (file)
@@ -17,18 +17,20 @@ import unittest
 
 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 @@ class TestIDLL10N(unittest.TestCase):
         """
         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 @@ class TestIDLL10N(unittest.TestCase):
         """
         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 @@ class TestIDLL10N(unittest.TestCase):
         """
         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)
index 56aeee2..6915367 100644 (file)
@@ -12,10 +12,11 @@ import unittest
 
 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 @@ class TestBaseL10N(unittest.TestCase):
     ]
 
     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)