feat(order_utils.py): schema resolver cache (#1317)

* Implemented basic functionality for using cache layer of LocalRefResolver

* Use `importlib` instead of `imp`, since it's been deprecated. Legacy `load_module()` reloads modules even if they are already imported, causing tests to fail when run in non-deterministic ordering, so we replace it with `import_module()`
This commit is contained in:
Daniel Pyrathon
2018-11-30 09:59:37 -08:00
committed by F. Eugene Aumson
parent fc3641b499
commit a1d4aa66bc
4 changed files with 81 additions and 38 deletions

View File

@@ -2,16 +2,17 @@
from doctest import testmod
import pkgutil
import importlib
import zero_ex
def test_all_doctests():
"""Gather zero_ex.* modules and doctest them."""
for (importer, modname, _) in pkgutil.walk_packages(
for (_, modname, _) in pkgutil.walk_packages(
path=zero_ex.__path__, prefix="zero_ex."
):
module = importer.find_module(modname).load_module(modname)
module = importlib.import_module(modname)
print(module)
(failure_count, _) = testmod(module)
assert failure_count == 0