mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 12:21:26 -07:00
Python3 fixes
This commit is contained in:
parent
a954220957
commit
e78c5f925b
6 changed files with 22 additions and 11 deletions
|
@ -15,10 +15,16 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import unittest
|
||||
|
||||
from mock import mock_open, patch, MagicMock
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
from ansible.compat.tests import unittest
|
||||
from ansible.compat.tests import BUILTINS
|
||||
|
||||
from ansible.compat.tests.mock import mock_open, patch, MagicMock
|
||||
|
||||
from ansible.plugins import MODULE_CACHE, PATH_CACHE, PLUGIN_PATH_CACHE, _basedirs, push_basedir, PluginLoader
|
||||
|
||||
|
@ -54,7 +60,7 @@ class TestErrors(unittest.TestCase):
|
|||
m = MagicMock()
|
||||
m.return_value.__file__ = '/path/to/my/test.py'
|
||||
pl = PluginLoader('test', 'foo.bar.bam', 'test', 'test_plugin')
|
||||
with patch('__builtin__.__import__', m):
|
||||
with patch('{0}.__import__'.format(BUILTINS), m):
|
||||
self.assertEqual(pl._get_package_paths(), ['/path/to/my/bar/bam'])
|
||||
|
||||
def test_plugins__get_paths(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue