From b554fccde31adb244d1c5814fb60787df14bd860 Mon Sep 17 00:00:00 2001 From: William Ronchetti Date: Fri, 21 Jul 2023 14:34:17 -0400 Subject: [PATCH] take some changes from Kent --- src/encoded/tests/test_ingestion_listener.py | 4 +-- src/encoded/tests/verifier.py | 35 ++++++++++---------- src/encoded/types/base.py | 4 +-- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/encoded/tests/test_ingestion_listener.py b/src/encoded/tests/test_ingestion_listener.py index 07d4cec01..e986950df 100644 --- a/src/encoded/tests/test_ingestion_listener.py +++ b/src/encoded/tests/test_ingestion_listener.py @@ -17,7 +17,7 @@ def wait_for_queue_to_catch_up(queue_manager, n, initially=False): """ - Wait until queue has done the things we told it to do. + Pause for enough time that probably the queue has done the things we told it to do. Right now this just sleeps for QUEUE_CATCH_UP_WAIT_SECONDS seconds in any non-initial situation (i.e., where initially is False), @@ -76,7 +76,7 @@ class MockedEnv: @classmethod def new_name(cls): - cls._last_version = last_version = int(datetime.datetime.now().timestamp() * 1000000) + cls._last_version = last_version = int(datetime.datetime.now().timestamp() * 1000000) # microseconds return "%s%s" % (cls.MOCKED_ENV_PREFIX, last_version) diff --git a/src/encoded/tests/verifier.py b/src/encoded/tests/verifier.py index 7f188047c..038be6c17 100644 --- a/src/encoded/tests/verifier.py +++ b/src/encoded/tests/verifier.py @@ -1,21 +1,21 @@ -from dcicutils.misc_utils import ignored +from dcicutils.misc_utils import ignored, PRINT from functools import wraps from snovault import TYPES from .test_create_mapping import test_create_mapping_correctly_maps_embeds -#from .test_embedding import test_add_default_embeds, test_manual_embeds -#from .test_schemas import compute_master_mixins, test_load_schema +# from .test_embedding import test_add_default_embeds, test_manual_embeds +# from .test_schemas import compute_master_mixins, test_load_schema def verifier(func): @wraps(func) def wrapper(*args, **kwargs): - print("running tests " + func.__name__) + PRINT(f"running tests {func.__name__}") try: res = func(*args, **kwargs) except Exception as e: - print("test failed with exception " + str(e.args)) + PRINT(f"test failed with exception {e}") else: - print("success") + PRINT("success") return res return wrapper @@ -51,19 +51,20 @@ def verify_profile(item_type, indexer_testapp): # is this something we actually know about? profile = indexer_testapp.get("/profiles/" + item_type + ".json").json assert profile + # transform profile page path to camel case item type item_type_camel = profile['id'].strip('.json').split('/')[-1] return item_type_camel -@verifier -def verify_schema(item_type_camel, registry): - # test schema - test_load_schema(item_type_camel + ".json", compute_master_mixins(), registry) +# @verifier +# def verify_schema(item_type_camel, registry): +# # test schema +# test_load_schema(item_type_camel + ".json", compute_master_mixins(), registry) @verifier def verify_can_embed(item_type_camel, es_item, indexer_testapp, registry): - # get the embedds + # get the embeds pyr_item_type = registry[TYPES].by_item_type[item_type_camel] embeds = pyr_item_type.embedded @@ -79,10 +80,10 @@ def verify_indexing(item_uuid, indexer_testapp): assert res -@verifier -def verify_embeds(registry, item_type): - test_add_default_embeds(registry, item_type) - test_manual_embeds(registry, item_type) +# @verifier +# def verify_embeds(registry, item_type): +# test_add_default_embeds(registry, item_type) +# test_manual_embeds(registry, item_type) @verifier @@ -96,10 +97,10 @@ def verify_item(item_uuid, indexer_testapp, testapp, registry): verify_get_by_accession(es_item, item_type, indexer_testapp) verify_get_from_db(item_uuid, item_type, indexer_testapp) item_type_camel = verify_profile(item_type, indexer_testapp) - verify_schema(item_type_camel, registry) + # verify_schema(item_type_camel, registry) verify_can_embed(item_type_camel, es_item, indexer_testapp, registry) verify_indexing(item_uuid, indexer_testapp) - verify_embeds(registry, item_type_camel) + # verify_embeds(registry, item_type_camel) verify_mapping(registry, item_type_camel) diff --git a/src/encoded/types/base.py b/src/encoded/types/base.py index f241ca67e..afb5c3313 100644 --- a/src/encoded/types/base.py +++ b/src/encoded/types/base.py @@ -53,13 +53,13 @@ def __init__(self, *args, **kw): super(Collection, self).__init__(*args, **kw) if hasattr(self, '__acl__'): if DEBUG_PERMISSIONS: - PRINT(f'DEBUG_PERMISSIONS: returning {self.__acl__} for {self.type_info.name}') + PRINT(f'DEBUG_PERMISSIONS: using {self.__acl__} for {self.type_info.name}') return # If no ACLs are defined for collection, allow submission centers to add/create if 'submission_centers' in self.type_info.factory.schema['properties']: if DEBUG_PERMISSIONS: - PRINT(f'DEBUG_PERMISSIONS: returning {ALLOW_SUBMISSION_CENTER_CREATE_ACL} for {self.type_info.name}') + PRINT(f'DEBUG_PERMISSIONS: using {ALLOW_SUBMISSION_CENTER_CREATE_ACL} for {self.type_info.name}') self.__acl__ = ALLOW_SUBMISSION_CENTER_CREATE_ACL else: self.__acl__ = ONLY_ADMIN_VIEW_ACL