diff options
author | Marius Gedminas <marius@gedmin.as> | 2017-01-09 22:42:30 +0200 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2017-01-10 07:37:36 -0800 |
commit | 240c388e6cfc0406035db5116b4bf826b9e045e2 (patch) | |
tree | 2d6c7e8d99e5b0022d9e48abf512a0decfe52b6c | |
parent | 941552d10702bf344b2213105d131b64f36fac1f (diff) | |
download | ansible-240c388e6cfc0406035db5116b4bf826b9e045e2.tar.gz |
Fix a test failure on Python 3.6 (#20030)
* Fix a test failure on Python 3.6
tox -e py36 failed with
======================================================================
ERROR: test_action_base__execute_module (units.plugins.action.test_action.TestActionBase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/mg/src/ansible/test/units/plugins/action/test_action.py", line 507, in test_action_base__execute_module
self.assertEqual(action_base._execute_module(), dict(_ansible_parsed=True, rc=0, stdout="ok", stdout_lines=['ok']))
File "/home/mg/src/ansible/lib/ansible/plugins/action/__init__.py", line 596, in _execute_module
remote_module_path = self._connection._shell.join_path(tmp, remote_module_filename)
File "/home/mg/opt/python36/lib/python3.6/unittest/mock.py", line 939, in __call__
return _mock_self._mock_call(*args, **kwargs)
File "/home/mg/opt/python36/lib/python3.6/unittest/mock.py", line 1005, in _mock_call
ret_val = effect(*args, **kwargs)
File "/home/mg/src/ansible/.tox/py36/lib/python3.6/posixpath.py", line 92, in join
genericpath._check_arg_types('join', a, *p)
File "/home/mg/src/ansible/.tox/py36/lib/python3.6/genericpath.py", line 149, in _check_arg_types
(funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'MagicMock'
because os.path.join() now checks argument types since Python 3.6 (due
to pathlib support, I expect).
* Use a more realistic module name in test
(cherry picked from commit d9b89ca577eb3156b7cc7f489f80312ef5b2be5d)
-rw-r--r-- | test/units/plugins/action/test_action.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/test/units/plugins/action/test_action.py b/test/units/plugins/action/test_action.py index 091b50fb88..04e23ff12a 100644 --- a/test/units/plugins/action/test_action.py +++ b/test/units/plugins/action/test_action.py @@ -465,6 +465,7 @@ class TestActionBase(unittest.TestCase): mock_connection = MagicMock() mock_connection.build_module_command.side_effect = build_module_command + mock_connection._shell.get_remote_filename.return_value = 'copy.py' mock_connection._shell.join_path.side_effect = os.path.join # we're using a real play context here |