summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pygments/lexers/__init__.py7
-rw-r--r--tests/test_basic_api.py4
2 files changed, 6 insertions, 5 deletions
diff --git a/pygments/lexers/__init__.py b/pygments/lexers/__init__.py
index 369b7cc4..80545b6c 100644
--- a/pygments/lexers/__init__.py
+++ b/pygments/lexers/__init__.py
@@ -166,15 +166,16 @@ def get_lexer_for_mimetype(_mime, **options):
raise ClassNotFound('no lexer for mimetype %r found' % _mime)
-def _iter_lexerclasses():
+def _iter_lexerclasses(plugins=True):
"""Return an iterator over all lexer classes."""
for key in sorted(LEXERS):
module_name, name = LEXERS[key][:2]
if name not in _lexer_cache:
_load_lexers(module_name)
yield _lexer_cache[name]
- for lexer in find_plugin_lexers():
- yield lexer
+ if plugins:
+ for lexer in find_plugin_lexers():
+ yield lexer
def guess_lexer_for_filename(_fn, _text, **options):
diff --git a/tests/test_basic_api.py b/tests/test_basic_api.py
index e6b9b325..6069f97c 100644
--- a/tests/test_basic_api.py
+++ b/tests/test_basic_api.py
@@ -80,7 +80,7 @@ def test_lexer_classes():
assert txt == test_content, "%s lexer roundtrip failed: %r != %r" % \
(cls.name, test_content, txt)
- for lexer in lexers._iter_lexerclasses():
+ for lexer in lexers._iter_lexerclasses(plugins=False):
yield verify, lexer
@@ -110,7 +110,7 @@ def test_lexer_options():
inst = cls(ensurenl=False, stripall=True)
ensure(inst.get_tokens('a\nb\n\n'), 'a\nb')
- for lexer in lexers._iter_lexerclasses():
+ for lexer in lexers._iter_lexerclasses(plugins=False):
if lexer.__name__ == 'RawTokenLexer':
# this one is special
continue