fixes import paths for ansible unit testing (#65775)

* fixes import paths for ansible unit testing

* Update docs/docsite/rst/dev_guide/testing_units_modules.rst

Co-Authored-By: Sandra McCann <samccann@redhat.com>
This commit is contained in:
Alicia Cozine 2019-12-16 11:07:26 -06:00 committed by GitHub
parent 6f76a48f59
commit 40fb46f1e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -160,7 +160,7 @@ Mock objects (from https://docs.python.org/3/library/unittest.mock.html) can be
useful in building unit tests for special / difficult cases, but they can also useful in building unit tests for special / difficult cases, but they can also
lead to complex and confusing coding situations. One good use for mocks would be in lead to complex and confusing coding situations. One good use for mocks would be in
simulating an API. As for 'six', the 'mock' python package is bundled with Ansible (use simulating an API. As for 'six', the 'mock' python package is bundled with Ansible (use
``import ansible.compat.tests.mock``). See for example ``import units.compat.mock``).
Ensuring failure cases are visible with mock objects Ensuring failure cases are visible with mock objects
---------------------------------------------------- ----------------------------------------------------
@ -385,8 +385,8 @@ mock for :meth:`Ansible.get_bin_path`::
import json import json
from ansible.compat.tests import unittest from units.compat import unittest
from ansible.compat.tests.mock import patch from units.compat.mock import patch
from ansible.module_utils import basic from ansible.module_utils import basic
from ansible.module_utils._text import to_bytes from ansible.module_utils._text import to_bytes
from ansible.modules.namespace import my_module from ansible.modules.namespace import my_module