mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
[PY3] Fix test that is flaky in Python 3
We can't rely on lists having the same order in Python3 the same way we rely on them in Python2. If we sort them first, and then compare them, this test will be more reliable.
This commit is contained in:
parent
41ef5225e9
commit
2be4865f48
@ -486,7 +486,7 @@ class TestCustomExtensions(TestCase):
|
|||||||
env = Environment(extensions=[SerializerExtension])
|
env = Environment(extensions=[SerializerExtension])
|
||||||
if six.PY3:
|
if six.PY3:
|
||||||
rendered = env.from_string('{{ dataset|unique }}').render(dataset=dataset).strip("'{}").split("', '")
|
rendered = env.from_string('{{ dataset|unique }}').render(dataset=dataset).strip("'{}").split("', '")
|
||||||
self.assertEqual(rendered, list(unique))
|
self.assertEqual(sorted(rendered), sorted(list(unique)))
|
||||||
else:
|
else:
|
||||||
rendered = env.from_string('{{ dataset|unique }}').render(dataset=dataset)
|
rendered = env.from_string('{{ dataset|unique }}').render(dataset=dataset)
|
||||||
self.assertEqual(rendered, u"{0}".format(unique))
|
self.assertEqual(rendered, u"{0}".format(unique))
|
||||||
|
Loading…
Reference in New Issue
Block a user