提交 d2b92bde 编写于 作者: C Cleber Rosa

avocado/core/tree.py: properly copy the TreeEnvironment

On Python 3, trying to copy a FilterSet, using the instance.copy()
method, will return a plain set() object.  This influences a number of
code, including the fingerprint generation, and the variant ID which
will be based on the hash of the fingerprint.

Let's make things predictable and copy using Python's standard module
copy.

This fixes the functional test in module `test_getdata` under Python
3, as the variant IDs are now the same on jobs run under Python 2 and
3.
Signed-off-by: NCleber Rosa <crosa@redhat.com>
上级 7dd39652
......@@ -34,6 +34,7 @@ original base tree code and re-license under GPLv2+, given that GPLv3 and GPLv2
"""
import collections
import copy
import itertools
import locale
......@@ -74,9 +75,9 @@ class TreeEnvironment(dict):
def copy(self):
cpy = TreeEnvironment()
cpy.update(self)
cpy.origin = self.origin.copy()
cpy.filter_only = self.filter_only.copy()
cpy.filter_out = self.filter_out.copy()
cpy.origin = copy.copy(self.origin)
cpy.filter_only = copy.copy(self.filter_only)
cpy.filter_out = copy.copy(self.filter_out)
return cpy
def __str__(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册