summaryrefslogtreecommitdiff
path: root/tests/test_cmdline.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2019-05-06 08:17:53 +0200
committerGeorg Brandl <georg@python.org>2019-11-10 10:15:13 +0100
commita41f232a0aa9f2b435e54a7e247c858a8f2d7fa8 (patch)
tree8245310d57e48e3e966a46f40e120d6ea3ce28f7 /tests/test_cmdline.py
parent7b418bd18e01b06ccaa1c7bd03d11abf303f2fbd (diff)
downloadpygments-git-a41f232a0aa9f2b435e54a7e247c858a8f2d7fa8.tar.gz
Initial port to py.test
Unittest classes are kept - for now - since py.test is ok with them. Generator tests had to be switched to pytest parametrized tests.
Diffstat (limited to 'tests/test_cmdline.py')
-rw-r--r--tests/test_cmdline.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py
index 169d690d..c76c1089 100644
--- a/tests/test_cmdline.py
+++ b/tests/test_cmdline.py
@@ -15,13 +15,14 @@ import re
import sys
import tempfile
import unittest
+from os import path
-import support
from pygments import cmdline, highlight
from pygments.util import BytesIO, StringIO
+TESTDIR = path.dirname(path.abspath(__file__))
+TESTFILE = path.join(TESTDIR, 'test_cmdline.py')
-TESTFILE, TESTDIR = support.location(__file__)
TESTCODE = '''\
def func(args):
pass
@@ -254,7 +255,7 @@ class CmdLineTest(unittest.TestCase):
self.assertTrue('Error: cannot read' in e)
# lexer file is malformed
- e = self.check_failure('-l', 'support/empty.py',
+ e = self.check_failure('-l', path.join(TESTDIR, 'support', 'empty.py'),
'-x', TESTFILE)
self.assertTrue('Error: no valid CustomLexer class found' in e)
@@ -276,7 +277,7 @@ class CmdLineTest(unittest.TestCase):
self.assertTrue('Error: cannot read' in e)
# formatter file is malformed
- e = self.check_failure('-f', 'support/empty.py',
+ e = self.check_failure('-f', path.join(TESTDIR, 'support', 'empty.py'),
'-x', TESTFILE)
self.assertTrue('Error: no valid CustomFormatter class found' in e)