Make test_doctest use entry points
Instead of just checking hacking.core for functions starting with 'hacking_' check the entry points for the full list of hacking check functions to test. This is needed to split hacking.core up and pull out the groups of checks into different modules. Change-Id: I0fb4059eb6bd6eece453a028b949cf15c4d85f89
This commit is contained in:
@@ -18,6 +18,7 @@ import re
|
|||||||
|
|
||||||
from flake8 import engine
|
from flake8 import engine
|
||||||
import pep8
|
import pep8
|
||||||
|
import pkg_resources
|
||||||
import six
|
import six
|
||||||
import testscenarios
|
import testscenarios
|
||||||
from testtools import content
|
from testtools import content
|
||||||
@@ -73,9 +74,11 @@ def load_tests(loader, tests, pattern):
|
|||||||
ignore=('F', 'H104'))
|
ignore=('F', 'H104'))
|
||||||
options = flake8_style.options
|
options = flake8_style.options
|
||||||
|
|
||||||
for name, check in hacking.core.__dict__.items():
|
for entry in pkg_resources.iter_entry_points('flake8.extension'):
|
||||||
if not name.startswith("hacking_"):
|
if not entry.module_name.startswith('hacking.'):
|
||||||
continue
|
continue
|
||||||
|
check = entry.load()
|
||||||
|
name = entry.attrs[0]
|
||||||
if six.PY3 and check.skip_on_py3:
|
if six.PY3 and check.skip_on_py3:
|
||||||
continue
|
continue
|
||||||
for (lineno, (raw, (code, source))) in enumerate(_get_lines(check)):
|
for (lineno, (raw, (code, source))) in enumerate(_get_lines(check)):
|
||||||
|
|||||||
Reference in New Issue
Block a user