Run avocado when called by 'python -m avocado'

Add a main entry point when avocado is called
by the command line option 'python -m avocado'.

Signed-off-by: Rudá Moura <rmoura@redhat.com>
selftests..multiplex_tests: Check that vars changes

Replace test_run_mplex_timeout with test_run_mplex_params test which
executes 'env_variables.sh' and checks that output contain correct
output. This test checks the multiplexer capability to change variable
value.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
Merge pull request #293 from ldoktor/selftest-mux

selftests..multiplex_tests: Check that vars changes
Merge pull request #292 from ruda/main_entry_point

 Run avocado when called by 'python -m avocado'
avocado.core.tree: Fix infinite recursion in TreeNode.__eq__

Original implementation compared self and then parent node. Parent
node again compared self and children => infinite recursion.

In the end we actually don't want to compare parents, because we care
about what is after this node. This implementation compares only Node
and children.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
avocado.core.tree: Fix TreeNode.iter_parents

Iterator should raise StopIteration, not return None.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
avocado.core.tree: Remove unnecesar branch from _create_from_yaml

Yaml creates pairs of items, thus isinstance(dict) branch should
not be possible (I hope).

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
avocado.core.tree: Use None instead of [] as defaults

defaults [] are not recommended, use None instead.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
avocado.multiplexer: Remove filter_only/filter_out

these functions were only used in unittests and were redundant to
tree.apply_filters().

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
avocado.multiplexer: Optimize any_sibling to existing siblings

We don't need to process all nodes in case of early match. Instead
of creating set of all parents this patch goes through Nodes
and checks parents and in case of parent-match returns immediately.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
avocado: Support for multiple multiplex yaml files

This patch adds support for multiple yaml files by merging the values
together. Merge overrides the nodes value and appends missing children
iteratively. It's deterministic AND order dependant (yaml1 yaml2 migh
not provide the same results as yaml2 yaml1!).

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
avocado.multiplexer: Rename create_variants_from_yaml to multiplex_yamls

create_variants_from_yaml is hideously long. Use multiplex_yamls instead.

Additionally change default values from lists to None.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
selftests..unit: Rewrite tree and multiplexer unittests

Instead of adjusting existing tests I rewrote them from scratch with
parallel execution in mind.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>