diff options
author | Thomas Aglassinger <roskakori@users.sourceforge.net> | 2013-06-02 14:12:38 +0000 |
---|---|---|
committer | Thomas Aglassinger <roskakori@users.sourceforge.net> | 2013-06-02 14:12:38 +0000 |
commit | f73c52a87b995806b4462a425a9f589031c57e9b (patch) | |
tree | aa63878cb7834ddc1f68ac980fd3294e298c0bb6 /tests/test_basic_api.py | |
parent | 1ea0fa53d253eae501f0a48611dd01493240b34d (diff) | |
download | pygments-f73c52a87b995806b4462a425a9f589031c57e9b.tar.gz |
Simplified debugging of endless loops in lexers with random generated content. If the developer terminates the test by pressing Control-C, the resulting KeyboardInterrupt describes the lexer and content that caused the test to get stuck.
Diffstat (limited to 'tests/test_basic_api.py')
-rw-r--r-- | tests/test_basic_api.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/test_basic_api.py b/tests/test_basic_api.py index 18ed8d64..9ec6e928 100644 --- a/tests/test_basic_api.py +++ b/tests/test_basic_api.py @@ -60,7 +60,10 @@ def test_lexer_classes(): if cls.name in ['XQuery', 'Opa']: # XXX temporary return - tokens = list(inst.get_tokens(test_content)) + try: + tokens = list(inst.get_tokens(test_content)) + except KeyboardInterrupt: + raise KeyboardInterrupt('interrupted %s.get_tokens(): test_content=%r' % (cls.name, test_content)) txt = "" for token in tokens: assert isinstance(token, tuple) |