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
pull/21741/head^2
Adrian Likins 8 years ago committed by GitHub
parent 02d2b753db
commit 718b786157

@ -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

Loading…
Cancel
Save