diff options
Diffstat (limited to 'tests/test_cmdline.py')
-rw-r--r-- | tests/test_cmdline.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py index 46868cf1..8cc2938c 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -16,6 +16,8 @@ import StringIO from pygments import highlight from pygments.cmdline import main as cmdline_main +from support import test_file + def run_cmdline(*args): saved_stdout = sys.stdout @@ -44,21 +46,22 @@ class CmdLineTest(unittest.TestCase): self.assertEquals(c, 0) def test_O_opt(self): - filename = os.path.join(testdir, testfile) + filename = test_file() 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 = test_file() 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 = __file__ + filename = filename[:-1] if filename.endswith("pyc") else filename + c, o, e = run_cmdline("-Fhighlight:tokentype=Name.Blubb,names=test_file filename", "-fhtml", filename) self.assertEquals(c, 0) self.assert_('<span class="n-Blubb' in o) @@ -82,7 +85,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 = test_file() code = file(filename).read() output = highlight(code, PythonLexer(), HtmlFormatter()) |