[Avocado-devel] Unexpected conversion of yaml content to ListOfNodeObjects

Vincent Matossian vastinnocentaims at gmail.com
Mon Feb 13 08:33:01 UTC 2017


I'm seeing an odd behavior on v0.45, when trying to load a yaml file in an
instrumented test the yaml content gets converted to a list of MuxTreeNodes
rather than a dictionary.

here's a simple example

mytest.py

#!/bin/env python
import yaml
from avocado import Test

class MyTest(Test):

    def test(self):
        with open("some.yaml") as f:
            d = yaml.load(f)
        print(type(d))
        print(d)


some.yaml:

key1:
  subkey: subval
key2:
  subkey: subval

An empty.yaml file

Run: avocado run --show-job-log mytest.py --mux-yaml empty.yaml

Relevant output:

START 1-d.py:MyTest.test
<class 'avocado.plugins.yaml_to_mux.ListOfNodeObjects'>
[MuxTreeNode(name='key1'), MuxTreeNode(name='key2')]
PASS 1-d.py:MyTest.test

If I drop the mux-yaml option then the output looks like what I'd expect

START 1-d.py:MyTest.test
<type 'dict'>
{'key2': {'subkey': 'subval'}, 'key1': {'subkey': 'subval'}}
PASS 1-d.py:MyTest.test


--mux-yaml seems to intercept all yaml conversions, this is not desirable
in my case as I lose the ability to use yaml in my test, my apologies for
not doing much research on whether this is a known, please let me know if I
missed the obvious or how I can work around it

Thanks

Vincent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/avocado-devel/attachments/20170213/8972b570/attachment.htm>


More information about the Avocado-devel mailing list