Skip to content

[FIX] mock.patch(auto_spec=True) does not exist#898

Merged
OCA-git-bot merged 1 commit intoOCA:18.0from
gurneyalex:18.0-queue_job_auto_test_typo
Feb 20, 2026
Merged

[FIX] mock.patch(auto_spec=True) does not exist#898
OCA-git-bot merged 1 commit intoOCA:18.0from
gurneyalex:18.0-queue_job_auto_test_typo

Conversation

@gurneyalex
Copy link
Member

There is no parameter auto_spec to mock.patch. This is likely a typo.

Running the tests with Python 3.12 give a RuntimeError

  File "/usr/local/lib/python3.12/unittest/mock.py", line 1311, in __init__
    _check_spec_arg_typos(kwargs)
  File "/usr/local/lib/python3.12/unittest/mock.py", line 1287, in _check_spec_arg_typos
    raise RuntimeError(
RuntimeError: 'auto_spec' might be a typo.

There is no parameter auto_spec to mock.patch. This is likely a typo.

Running the tests with Python 3.12 give a RuntimeError
```
  File "/usr/local/lib/python3.12/unittest/mock.py", line 1311, in __init__
    _check_spec_arg_typos(kwargs)
  File "/usr/local/lib/python3.12/unittest/mock.py", line 1287, in _check_spec_arg_typos
    raise RuntimeError(
RuntimeError: 'auto_spec' might be a typo.
```
@OCA-git-bot
Copy link
Contributor

Hi @guewen, @sbidoul,
some modules you are maintaining are being modified, check this out!

with mock.patch(
"odoo.addons.queue_job.delay.Job",
name="Job Class",
auto_spec=True,
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, I thought about that too. The thing is that auto_spec never did anything, and things have been working so far, which is why I'm tempted to just remove the kwarg.

Copy link
Member Author

Choose a reason for hiding this comment

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

and removing it does not break the tests...

@gurneyalex gurneyalex requested a review from guewen February 19, 2026 16:35
@gurneyalex gurneyalex marked this pull request as ready for review February 20, 2026 07:32
@gurneyalex
Copy link
Member Author

I will backport this.

@guewen
Copy link
Member

guewen commented Feb 20, 2026

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 18.0-ocabot-merge-pr-898-by-guewen-bump-nobump, awaiting test results.

@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 2601ebb. Thanks a lot for contributing to OCA. ❤️

@OCA-git-bot OCA-git-bot merged commit 2601ebb into OCA:18.0 Feb 20, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Comments