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

tests(unit): charm unit tests fail with 'CallSpec2' object has no attribute 'funcargs' #1185

Closed
orfeas-k opened this issue Dec 9, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@orfeas-k
Copy link
Contributor

orfeas-k commented Dec 9, 2024

Bug Description

During #1156, we figured out that after bumping python dependencies (pytest>8.0), unit tests in some charm repos fail with the following error:

AttributeError: 'CallSpec2' object has no attribute 'funcargs'

This is caused by issue TvoroG/pytest-lazy-fixture#65. The referenced package is though unmaintained and thus does not work with pytest>=8.0. What is being suggested is to switch from pytest-lazy-fixture to pytest-lazy-fixtures (with an "s" at the end), which seems to be supporting all the features of the first one + being maintained. In some cases, the pytest-lazy-fixtures is a leftover package not used anymore and can be just removed from the packages (ie resource-dispatcher canonical/resource-dispatcher#77)

To Reproduce

Run unit test in repositories affected.

Environment

main branch

Relevant Log Output

# from mlflow repo https://github.com/canonical/mlflow-operator/actions/runs/12195468207/job/34021150692
____________________ ERROR collecting tests/unit/test_s3.py ____________________
Traceback (most recent call last):
  File "/home/runner/work/mlflow-operator/mlflow-operator/.tox/unit/lib/python3.8/site-packages/_pytest/runner.py", line 341, in from_call
    result: TResult | None = func()
  File "/home/runner/work/mlflow-operator/mlflow-operator/.tox/unit/lib/python3.8/site-packages/_pytest/runner.py", line 389, in collect
    return list(collector.collect())
  File "/home/runner/work/mlflow-operator/mlflow-operator/.tox/unit/lib/python3.8/site-packages/_pytest/python.py", line 552, in collect
    return super().collect()
  File "/home/runner/work/mlflow-operator/mlflow-operator/.tox/unit/lib/python3.8/site-packages/_pytest/python.py", line 419, in collect
    res = ihook.pytest_pycollect_makeitem(
  File "/home/runner/work/mlflow-operator/mlflow-operator/.tox/unit/lib/python3.8/site-packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  File "/home/runner/work/mlflow-operator/mlflow-operator/.tox/unit/lib/python3.8/site-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/home/runner/work/mlflow-operator/mlflow-operator/.tox/unit/lib/python3.8/site-packages/pluggy/_callers.py", line 182, in _multicall
    return outcome.get_result()
  File "/home/runner/work/mlflow-operator/mlflow-operator/.tox/unit/lib/python3.8/site-packages/pluggy/_result.py", line 100, in get_result
    raise exc.with_traceback(exc.__traceback__)
  File "/home/runner/work/mlflow-operator/mlflow-operator/.tox/unit/lib/python3.8/site-packages/pluggy/_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
  File "/home/runner/work/mlflow-operator/mlflow-operator/.tox/unit/lib/python3.8/site-packages/_pytest/python.py", line 245, in pytest_pycollect_makeitem
    return list(collector._genfunctions(name, obj))
  File "/home/runner/work/mlflow-operator/mlflow-operator/.tox/unit/lib/python3.8/site-packages/_pytest/python.py", line 462, in _genfunctions
    self.ihook.pytest_generate_tests.call_extra(methods, dict(metafunc=metafunc))
  File "/home/runner/work/mlflow-operator/mlflow-operator/.tox/unit/lib/python3.8/site-packages/pluggy/_hooks.py", line 574, in call_extra
    return self._hookexec(self.name, hookimpls, kwargs, firstresult)
  File "/home/runner/work/mlflow-operator/mlflow-operator/.tox/unit/lib/python3.8/site-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/home/runner/work/mlflow-operator/mlflow-operator/.tox/unit/lib/python3.8/site-packages/pluggy/_callers.py", line 156, in _multicall
    teardown[0].send(outcome)
  File "/home/runner/work/mlflow-operator/mlflow-operator/.tox/unit/lib/python3.8/site-packages/pytest_lazyfixture.py", line 74, in pytest_generate_tests
    normalize_metafunc_calls(metafunc, 'funcargs')
  File "/home/runner/work/mlflow-operator/mlflow-operator/.tox/unit/lib/python3.8/site-packages/pytest_lazyfixture.py", line 81, in normalize_metafunc_calls
    calls = normalize_call(callspec, metafunc, valtype, used_keys)
  File "/home/runner/work/mlflow-operator/mlflow-operator/.tox/unit/lib/python3.8/site-packages/pytest_lazyfixture.py", line 105, in normalize_call
    valtype_keys = set(getattr(callspec, valtype).keys()) - used_keys
AttributeError: 'CallSpec2' object has no attribute 'funcargs'
=============================== warnings summary ===============================
.tox/unit/lib/python3.8/site-packages/_pytest/python.py:462
  /home/runner/work/mlflow-operator/mlflow-operator/.tox/unit/lib/python3.8/site-packages/_pytest/python.py:462: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
  Plugin: lazy-fixture, Hook: pytest_generate_tests
  AttributeError: 'CallSpec2' object has no attribute 'funcargs'
  For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning
    self.ihook.pytest_generate_tests.call_extra(methods, dict(metafunc=metafunc))

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
ERROR tests/unit/test_s3.py - AttributeError: 'CallSpec2' object has no attribute 'funcargs'
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!

Additional Context

No response

@orfeas-k orfeas-k added the bug Something isn't working label Dec 9, 2024
Copy link

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/KF-6660.

This message was autogenerated

orfeas-k added a commit to canonical/kubeflow-dashboard-operator that referenced this issue Dec 13, 2024
* Pin pip to 24.2 due to jazzband/pip-tools#2131
* Update python dependencies using 'tox -e update-requirements'
* Remove unused pytest-lazy-fixture package

Ref canonical/bundle-kubeflow#1177
Ref canonical/bundle-kubeflow#1185
orfeas-k added a commit to canonical/mlflow-operator that referenced this issue Dec 13, 2024
* Pin pip to 24.2 due to jazzband/pip-tools#2131
* Update python dependencies using 'tox -e update-requirements'
* migrate `pytest-lazyfixture` to `pytest-lazy-fixtures` (with an "s" at the end)

Ref canonical/bundle-kubeflow#1177
Ref canonical/bundle-kubeflow#1185
orfeas-k added a commit to canonical/minio-operator that referenced this issue Dec 13, 2024
* Pin pip to 24.2 due to jazzband/pip-tools#2131
* Update python dependencies using 'tox -e update-requirements'
* Remove unused pytest-lazy-fixture package
* Remove mocking of private ops class according to canonical/operator#1369 and canonical/seldon-core-operator#268

Ref canonical/bundle-kubeflow#1177
Ref canonical/bundle-kubeflow#1185
orfeas-k added a commit to canonical/metacontroller-operator that referenced this issue Dec 13, 2024
* Pin pip to 24.2 due to jazzband/pip-tools#2131
* Update python dependencies using 'tox -e update-requirements'
* Remove unused pytest-lazy-fixture package
* Bump chisme to 0.4.4 to fix #138

Ref canonical/bundle-kubeflow#1177
Ref canonical/bundle-kubeflow#1185
Fixes #138
orfeas-k added a commit to canonical/resource-dispatcher that referenced this issue Dec 13, 2024
* Pin pip to 24.2 due to jazzband/pip-tools#2131
* Update python dependencies using 'tox -e update-requirements'

Ref canonical/bundle-kubeflow#1177
Ref canonical/bundle-kubeflow#1185
orfeas-k added a commit to canonical/oidc-gatekeeper-operator that referenced this issue Dec 13, 2024
* Pin pip to 24.2 due to jazzband/pip-tools#2131
* Update python dependencies using 'tox -e update-requirements'
* Remove unused pytest-lazy-fixture package

Ref canonical/bundle-kubeflow#1177
Ref canonical/bundle-kubeflow#1185
@orfeas-k
Copy link
Contributor Author

Closed by referenced PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant