From 4088aa2b4cd4372ef4e69cc183ae9f8d75253d13 Mon Sep 17 00:00:00 2001 From: Robin Roth Date: Fri, 15 Apr 2016 19:30:49 +0200 Subject: [PATCH] get rid of assert_in --- test/units/module_utils/test_distribution_version.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/units/module_utils/test_distribution_version.py b/test/units/module_utils/test_distribution_version.py index a93446811d..a913c5b6bb 100644 --- a/test/units/module_utils/test_distribution_version.py +++ b/test/units/module_utils/test_distribution_version.py @@ -29,7 +29,7 @@ from ansible.utils.unicode import to_bytes # for testing from ansible.compat.tests import unittest from ansible.compat.tests.mock import patch -from nose.tools import assert_in, assert_equal +from nose.tools import assert_equal # the module we are actually testing @@ -322,7 +322,7 @@ def test_distribution_version(): """ # needs to be in here, because the import fails with python3 still - import ansible.module_utils.facts + import ansible.module_utils.facts as facts real_stdin = sys.stdin from ansible.module_utils import basic @@ -339,13 +339,13 @@ def test_distribution_version(): # run individual tests via generator # set nicer stdout output for nosetest _test_one_distribution.description = "check distribution_version for %s" % t['name'] - yield _test_one_distribution, module, t + yield _test_one_distribution, facts, module, t sys.stdin = real_stdin -def _test_one_distribution(module, testcase): +def _test_one_distribution(facts, module, testcase): """run the test on one distribution testcase * prepare some mock functions to get the testdata in @@ -380,13 +380,13 @@ def _test_one_distribution(module, testcase): @patch('platform.dist', lambda: testcase['platform.dist']) @patch('platform.system', lambda: 'Linux') def get_facts(testcase): - return ansible.module_utils.facts.Facts(module).populate() + return facts.Facts(module).populate() generated_facts = get_facts(testcase) # testcase['result'] has a list of variables and values it expects Facts() to set for key, val in testcase['result'].items(): - assert_in(key, generated_facts) + assert key in generated_facts msg = 'Comparing value of %s on %s, should: %s, is: %s' %\ (key, testcase['name'], val, generated_facts[key]) assert_equal(generated_facts[key], val, msg)