summaryrefslogtreecommitdiff
path: root/tests/test_phystokens.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2017-05-04 07:35:24 -0400
committerNed Batchelder <ned@nedbatchelder.com>2017-05-04 07:35:24 -0400
commit67f905e4b7002d71d7ab33b87089a876eb4ef66c (patch)
tree44bb3f7b60ca37933e1adc887367c771777cbbb2 /tests/test_phystokens.py
parentb48ec04376ae5c9103bb73e1146473d70c1e5c8e (diff)
downloadpython-coveragepy-git-67f905e4b7002d71d7ab33b87089a876eb4ef66c.tar.gz
Refactor common test infrastructure for fiddling sys.path and finding files
Diffstat (limited to 'tests/test_phystokens.py')
-rw-r--r--tests/test_phystokens.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/tests/test_phystokens.py b/tests/test_phystokens.py
index ddb652e6..15bc6af0 100644
--- a/tests/test_phystokens.py
+++ b/tests/test_phystokens.py
@@ -12,7 +12,7 @@ from coverage.phystokens import source_token_lines, source_encoding
from coverage.phystokens import neuter_encoding_declaration, compile_unicode
from coverage.python import get_python_source
-from tests.coveragetest import CoverageTest
+from tests.coveragetest import CoverageTest, TESTS_DIR
# A simple program and its token stream.
@@ -43,9 +43,6 @@ MIXED_WS_TOKENS = [
[('ws', ' '), ('nam', 'b'), ('op', '='), ('str', '"indented"')],
]
-# Where this file is, so we can find other files next to it.
-HERE = os.path.dirname(__file__)
-
class PhysTokensTest(CoverageTest):
"""Tests for coverage.py's improved tokenizer."""
@@ -83,14 +80,14 @@ class PhysTokensTest(CoverageTest):
def test_tokenize_real_file(self):
# Check the tokenization of a real file (large, btw).
- real_file = os.path.join(HERE, "test_coverage.py")
+ real_file = os.path.join(TESTS_DIR, "test_coverage.py")
self.check_file_tokenization(real_file)
def test_stress(self):
# Check the tokenization of a stress-test file.
- stress = os.path.join(HERE, "stress_phystoken.tok")
+ stress = os.path.join(TESTS_DIR, "stress_phystoken.tok")
self.check_file_tokenization(stress)
- stress = os.path.join(HERE, "stress_phystoken_dos.tok")
+ stress = os.path.join(TESTS_DIR, "stress_phystoken_dos.tok")
self.check_file_tokenization(stress)