On 02/13/2017 03:33 AM, Vincent Matossian wrote: > > 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 > >
On my machine: $ avocado --show test run mytest.py | grep -e type -e key1 <type 'dict'> {'key2': {'subkey': 'subval'}, 'key1': {'subkey': 'subval'}} $ avocado --show test run mytest.py --mux-yaml empty.yaml | grep -e type -e key1 <type 'dict'> {'key2': {'subkey': 'subval'}, 'key1': {'subkey': 'subval'}} That is, I can not reproduce it. I'm running avocado from latest master (337b333e1b58f18f876c993121454f2f6cb599db). Can you share your own version? > --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 > If this turns out to be reproducible, it may point at some serious problems with Avocado: the runner influencing the "yaml" module loaded in the test. I really want to check if this is a current bug. > Thanks > Thank you for reporting it. > Vincent > -- Cleber Rosa [ Sr Software Engineer - Virtualization Team - Red Hat ] [ Avocado Test Framework - avocado-framework.github.io ]
signature.asc
Description: OpenPGP digital signature