Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ygorelik opened this issue Nov 28, 2018 · 1 comment

Comments

@ygorelik
Copy link
Collaborator

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

ygorelik pushed a commit to ygorelik/ydk-gen that referenced this issue Dec 12, 2018
@ygorelik
Copy link
Collaborator Author

Resolved in YDK-0.8.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant