Fix test failures if 'future' package is installed (#15005)

The python 'future' module provides a 'builtins' package
to emulate the py3 'builtins' modules. If installed, the
unit tests that reference builtins.__import__ fail because
the future 'builtins' is imported and it is missing __import__.

Use ansible.compat.six.moves.builtins instead of importing
'builtins' or __builtin__

Fixes #14996
This commit is contained in:
Adrian Likins 2017-02-16 11:36:26 -05:00 committed by GitHub
parent 02d2b753db
commit 718b786157

View file

@ -22,15 +22,9 @@ __metaclass__ = type
import os
try:
import builtins
except ImportError:
import __builtin__ as builtins
from ansible import constants as C
from ansible.compat.six import text_type
from ansible.compat.six.moves import shlex_quote
from ansible.compat.six.moves import shlex_quote, builtins
from ansible.compat.tests import unittest
from ansible.compat.tests.mock import patch, MagicMock, mock_open