anatoly techtonik  committed ca0b6bf

Fix Roundup path in message wikification test, improve
error message and allow option passing to unittest.

  • Participants
  • Parent commits ee130b0

Comments (0)

Files changed (1)

File extensions/test/

 import unittest
 import os.path
-if len(sys.argv) != 2:
-    sys.exit('Error: You have to provide the path of Roundup in order to run '
-             'the tests (e.g. /opt/tracker-roundup/lib/python2.7/site-packages/).')
+if len(sys.argv) < 2:
+    print('Usage: %s [options] <path to roundup>' % sys.argv[0])
+    sys.exit('\nError: Roundup path is needed to run the tests\n'
+             '(e.g. /opt/tracker-roundup/lib/python2.7/site-packages)')
 # add to sys.path the dir where roundup is installed (local_replace will try
 # to import it)
+rounddir = sys.argv.pop()
 testdir = os.path.dirname(os.path.abspath(__file__))
 dirs = testdir.split(os.path.sep)
 # add the dir where local_replace is (i.e. one level up)
 # add the dir where the roundup tests are
-sys.path.append(os.path.sep.join(dirs[:-3] + ['roundup', 'test']))
+sys.path.append(os.path.sep.join([rounddir, 'test']))
 from local_replace import PyDevStringHTMLProperty