Commit aba105ed authored by Mitar's avatar Mitar
Browse files

Check primitive annotations coverage.

Fixes #301.
parent c5861070
Pipeline #109053985 failed with stages
in 9 minutes and 35 seconds
......@@ -3,6 +3,7 @@
import argparse
import collections
import contextlib
import functools
import glob
import hashlib
import io
......@@ -177,6 +178,14 @@ class ValidationError(ValueError):
pass
@functools.lru_cache()
def get_all_primitives_for_interface_version(interface_version):
return {
PRIMITIVE_ANNOTATION_REGEX.search(file_path).groupdict()['python_path']
for file_path in glob.glob('{interface_version}/*/*/*/primitive.json'.format(interface_version=interface_version))
}
def make_hashable(obj):
if isinstance(obj, dict):
return frozendict.frozendict({make_hashable(key): make_hashable(value) for key, value in obj.items()})
......@@ -704,6 +713,19 @@ def validate_installation(primitive_names, interface_version, installation, anno
error_count += len(primitive_names)
return
print(">>> All primitives installed now:", flush=True)
all_primitives_installed = set(docker_exec(docker_container, ['python3', '-m', 'd3m', 'index', 'search']).splitlines())
all_primitives_with_annotations = get_all_primitives_for_interface_version(interface_version)
primitives_difference = all_primitives_installed - all_primitives_with_annotations
if primitives_difference:
print(">>> ERROR {primitive_names}: Additional primitives installed without primitive annotations.".format(primitive_names=primitive_names), flush=True)
print(">>> Additional primitives:", flush=True)
for primitive_path in sorted(primitives_difference):
print(primitive_path, flush=True)
error_count += len(primitives_difference)
return
# We copy and store d3m package again, to compare.
print(">>> Copying d3m Python package.", flush=True)
updated_python_lib_dir = tempfile.TemporaryDirectory()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment