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>
pull/65885/head
Alicia Cozine 5 years ago committed by GitHub
parent 6f76a48f59
commit 40fb46f1e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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
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
``import ansible.compat.tests.mock``). See for example
``import units.compat.mock``).
Ensuring failure cases are visible with mock objects
----------------------------------------------------
@ -385,8 +385,8 @@ mock for :meth:`Ansible.get_bin_path`::
import json
from ansible.compat.tests import unittest
from ansible.compat.tests.mock import patch
from units.compat import unittest
from units.compat.mock import patch
from ansible.module_utils import basic
from ansible.module_utils._text import to_bytes
from ansible.modules.namespace import my_module

Loading…
Cancel
Save