Skip to content

Test for non-top level Entity fails when bundle created with 'one-class-per-module' flag #839

@ygorelik

Description

@ygorelik

Current Behavior

Tests on newly introduced feature #603 (providing support for non-top level objects in CRUD operations) fails, when bundle is generated with 'one-class-per-module' flag. Apparently that is happening due to change in the content of lookup table.

Steps to Reproduce

Generate ydktest model bundle with 'one-class-per-module' flag. Then run the script below.

Observe this error:

ERROR: test_iden_list (__main__.SanityYang)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "sdk/python/core/tests/test_sanity_levels.py", line 688, in test_iden_list
    read_one = self.crud.read(self.ncc, filter)
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/ydk/services/crud_service.py", line 63, in read
    top_filters = _get_top_level_entity(filters, provider.get_session().get_root_schema())
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/ydk/entity_utils/entity_utils.py", line 204, in _get_top_level_entity
    return _datanode_to_entity(data_node)
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/ydk/entity_utils/entity_utils.py", line 79, in _datanode_to_entity
    entity = getattr(imported_module, class_name)()
AttributeError: 'module' object has no attribute 'runner.runner.Runner'

Your Script

    def test_iden_list(self):
        # CREATE
        il = Runner.OneList.IdentityList()
        il.config.id = ChildIdentity()
        il.id_ref = ChildIdentity()
        self.crud.create(self.ncc, il)

        # READ & VALIDATE
        filter = Runner.OneList()
        read_one = self.crud.read(self.ncc, filter)
        self.assertIsNotNone(read_one)

        read_il = read_one.identity_list.get(ChildIdentity().to_string())
        self.assertIsNotNone(read_il)
        read_il.parent = None
        self.assertEqual(read_il, il)
        
        # DELETE & VALIDATE
        self.crud.delete(self.ncc, il)
        runner_read = self.crud.read(self.ncc, Runner())
        self.assertIsNone(runner_read)

System Information

YDK-0.8.1 any system, any Python version

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions