diff options
author | Benjamin Peterson <devnull@localhost> | 2008-09-18 21:03:16 -0500 |
---|---|---|
committer | Benjamin Peterson <devnull@localhost> | 2008-09-18 21:03:16 -0500 |
commit | ae5c5fdb18fa618e84c408264f596ebdec96e5df (patch) | |
tree | a4feb5b6a971d2b72b4827bd7a33d33aa46fa9bd /tests/test_cmdline.py | |
parent | e6600347dac8dddc630cac6e55c08dea84b20f00 (diff) | |
download | pygments-ae5c5fdb18fa618e84c408264f596ebdec96e5df.tar.gz |
remove __builtin__.testdir/testfile magic
This adds a new file tests/support.py
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()) |