diff options
Diffstat (limited to 'tests/support.py')
-rw-r--r-- | tests/support.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/support.py b/tests/support.py new file mode 100644 index 00000000..f2df4747 --- /dev/null +++ b/tests/support.py @@ -0,0 +1,25 @@ +# coding: utf-8 +""" +Support for Pygments tests +""" + +import os +import random + + +def _get_all_test_files(): + tests = [] + here = os.path.abspath(os.path.dirname(__file__)) + for dirpath, dirs, files in os.walk(here): + tests.extend(os.path.join(dirpath, fn) for fn in files + if fn.startswith("test_") and fn.endswith(".py")) + dirs[:] = [d for d in dirs if d.startswith("test_")] + return tests + +_testfiles = _get_all_test_files() + +def test_file(): + """ + Randomly choose a file to test. + """ + return random.choice(_testfiles) |