Commits

anatoly techtonik committed ca0b6bf

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

Comments (0)

Files changed (1)

extensions/test/test_local_replace.py

 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)
-sys.path.append(sys.argv.pop())
+rounddir = sys.argv.pop()
+sys.path.append(rounddir)
 
 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)
 sys.path.append(os.path.sep.join(dirs[:-1]))
 # 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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.