Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: make ansible test serial #5677

Merged
merged 1 commit into from
Sep 6, 2024
Merged

Conversation

holmanb
Copy link
Member

@holmanb holmanb commented Sep 6, 2024

chore: make ansible test serial

Additional Context

Arguably we should modify the test, but for now just mark it as serial to fix the py3-fast tox env.

tox -e py3-fast

Merge type

  • Squash merge using "Proposed Commit Message"
  • Rebase and merge unique commits. Requires commit messages per-commit each referencing the pull request number (#<PR_NUM>)

Copy link
Member

@TheRealFalcon TheRealFalcon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird. Invoking pytest -n auto manually works fine here.

@holmanb
Copy link
Member Author

holmanb commented Sep 6, 2024

For future context the failure condition is this:

________________________________ TestAnsible.test_pip_bootstrap ________________________________
[gw3] linux -- Python 3.12.3 /home/holmanb/ci-e/.tox/py3-fast/bin/python

self = <tests.unittests.config.test_cc_ansible.TestAnsible object at 0x74d7eb544e30>
m_which = <MagicMock name='which' id='128470710989264'>
m_subp = <MagicMock name='subp' id='128470710298016'>

    @mock.patch(M_PATH + "subp.subp", return_value=("stdout", "stderr"))
    @mock.patch(M_PATH + "subp.which", return_value=False)
    def test_pip_bootstrap(self, m_which, m_subp):
        distro = get_cloud(mocked_distro=True).distro
        with mock.patch("builtins.__import__", side_effect=ImportError):
>           cc_ansible.AnsiblePullPip(distro, "ansible").install("")

tests/unittests/config/test_cc_ansible.py:338: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
cloudinit/config/cc_ansible.py:111: in install
    sysconfig.get_path("stdlib"), "EXTERNALLY-MANAGED"
/usr/lib/python3.12/sysconfig.py:672: in get_path
    return get_paths(scheme, vars, expand)[name]
/usr/lib/python3.12/sysconfig.py:662: in get_paths
    return _expand_vars(scheme, vars)
/usr/lib/python3.12/sysconfig.py:294: in _expand_vars
    _extend_dict(vars, get_config_vars())
/usr/lib/python3.12/sysconfig.py:765: in get_config_vars
    _init_config_vars()
/usr/lib/python3.12/sysconfig.py:706: in _init_config_vars
    _init_posix(_CONFIG_VARS)
/usr/lib/python3.12/sysconfig.py:572: in _init_posix
    _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
/usr/lib/python3.12/unittest/mock.py:1134: in __call__
    return self._mock_call(*args, **kwargs)
/usr/lib/python3.12/unittest/mock.py:1138: in _mock_call
    return self._execute_mock_call(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <MagicMock name='__import__' id='128470679590752'>
args = ('_sysconfigdata__x86_64-linux-gnu', {'_ALWAYS_STR': {'MACOSX_DEPLOYMENT_TARGET'}, '_BASE_EXEC_PREFIX': '/usr', '_BASE.../py3-fast', 'exec_prefix': '/home/holmanb/ci-e/.tox/py3-fast', 'installed_base': '/usr', ...}}, ['build_time_vars'], 0)
kwargs = {}, effect = <class 'ImportError'>

    def _execute_mock_call(self, /, *args, **kwargs):
        # separate from _increment_mock_call so that awaited functions are
        # executed separately from their call, also AsyncMock overrides this method
    
        effect = self.side_effect
        if effect is not None:
            if _is_exception(effect):
>               raise effect
E               ImportError

/usr/lib/python3.12/unittest/mock.py:1193: ImportError

@holmanb holmanb merged commit 8b99980 into canonical:main Sep 6, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants