summaryrefslogtreecommitdiff
path: root/tests/test_cmdline.py
diff options
context:
space:
mode:
authorgbrandl <devnull@localhost>2008-09-23 23:06:28 +0200
committergbrandl <devnull@localhost>2008-09-23 23:06:28 +0200
commita34d0680ec7181202ee5adb4bf185ff1ffc9e0ed (patch)
tree9eafc4f149b9a17216fd0d08e5e36ecbf5761335 /tests/test_cmdline.py
parent6e735f945f1845566f9e5dbcf956b6d1c8f54916 (diff)
parent420f7fa8594b96d6eed23073f0525a431218bb3e (diff)
downloadpygments-a34d0680ec7181202ee5adb4bf185ff1ffc9e0ed.tar.gz
Merge with ben-file2open.
Diffstat (limited to 'tests/test_cmdline.py')
-rw-r--r--tests/test_cmdline.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py
index 46868cf1..eaf1cbfc 100644
--- a/tests/test_cmdline.py
+++ b/tests/test_cmdline.py
@@ -16,6 +16,10 @@ import StringIO
from pygments import highlight
from pygments.cmdline import main as cmdline_main
+import support
+
+TESTFILE, TESTDIR = support.location(__file__)
+
def run_cmdline(*args):
saved_stdout = sys.stdout
@@ -44,21 +48,21 @@ class CmdLineTest(unittest.TestCase):
self.assertEquals(c, 0)
def test_O_opt(self):
- filename = os.path.join(testdir, testfile)
+ filename = TESTFILE
c, o, e = run_cmdline("-Ofull=1,linenos=true,foo=bar", "-fhtml", filename)
self.assertEquals(c, 0)
self.assert_("<html" in o)
self.assert_('class="linenos"' in o)
def test_P_opt(self):
- filename = os.path.join(testdir, testfile)
+ filename = TESTFILE
c, o, e = run_cmdline("-Pfull", "-Ptitle=foo, bar=baz=,", "-fhtml", filename)
self.assertEquals(c, 0)
self.assert_("<title>foo, bar=baz=,</title>" in o)
def test_F_opt(self):
- filename = os.path.join(testdir, testfile)
- c, o, e = run_cmdline("-Fhighlight:tokentype=Name.Blubb,names=testfile testdir",
+ filename = TESTFILE
+ c, o, e = run_cmdline("-Fhighlight:tokentype=Name.Blubb,names=TESTFILE filename",
"-fhtml", filename)
self.assertEquals(c, 0)
self.assert_('<span class="n-Blubb' in o)
@@ -82,7 +86,7 @@ class CmdLineTest(unittest.TestCase):
# test that cmdline gives the same output as library api
from pygments.lexers import PythonLexer
from pygments.formatters import HtmlFormatter
- filename = os.path.join(testdir, testfile)
+ filename = TESTFILE
code = file(filename).read()
output = highlight(code, PythonLexer(), HtmlFormatter())