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:
Joe Gordon 2014-04-09 22:57:16 -07:00
parent e6f4b3abfb
commit e3a8df98d3

View File

@ -18,6 +18,7 @@ import re
from flake8 import engine
import pep8
import pkg_resources
import six
import testscenarios
from testtools import content
@ -73,9 +74,11 @@ def load_tests(loader, tests, pattern):
ignore=('F', 'H104'))
options = flake8_style.options
for name, check in hacking.core.__dict__.items():
if not name.startswith("hacking_"):
for entry in pkg_resources.iter_entry_points('flake8.extension'):
if not entry.module_name.startswith('hacking.'):
continue
check = entry.load()
name = entry.attrs[0]
if six.PY3 and check.skip_on_py3:
continue
for (lineno, (raw, (code, source))) in enumerate(_get_lines(check)):