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

Crash: ValueError('%r is not callable' % (type_func,)) with 1.8.0 #242

Closed
paulschreiber opened this issue Oct 17, 2024 · 6 comments
Closed

Comments

@paulschreiber
Copy link

Description

After updating from 1.7.0 to 1.80, tests fail to run when pytest-profiling is installed (even if it's not used for a test run).

Here's the stack trace:

$ pytest soil_id
Traceback (most recent call last):
  File "/Users/paul/.dev/techmatters/soil-id-algorithm/env/bin/pytest", line 8, in <module>
    sys.exit(console_main())
             ~~~~~~~~~~~~^^
  File "/Users/paul/.dev/techmatters/soil-id-algorithm/env/lib/python3.13/site-packages/_pytest/config/__init__.py", line 201, in console_main
    code = main()
  File "/Users/paul/.dev/techmatters/soil-id-algorithm/env/lib/python3.13/site-packages/_pytest/config/__init__.py", line 156, in main
    config = _prepareconfig(args, plugins)
  File "/Users/paul/.dev/techmatters/soil-id-algorithm/env/lib/python3.13/site-packages/_pytest/config/__init__.py", line 341, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
        pluginmanager=pluginmanager, args=args
    )
  File "/Users/paul/.dev/techmatters/soil-id-algorithm/env/lib/python3.13/site-packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/paul/.dev/techmatters/soil-id-algorithm/env/lib/python3.13/site-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/paul/.dev/techmatters/soil-id-algorithm/env/lib/python3.13/site-packages/pluggy/_callers.py", line 139, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "/Users/paul/.dev/techmatters/soil-id-algorithm/env/lib/python3.13/site-packages/pluggy/_callers.py", line 122, in _multicall
    teardown.throw(exception)  # type: ignore[union-attr]
    ~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/Users/paul/.dev/techmatters/soil-id-algorithm/env/lib/python3.13/site-packages/_pytest/helpconfig.py", line 105, in pytest_cmdline_parse
    config = yield
             ^^^^^
  File "/Users/paul/.dev/techmatters/soil-id-algorithm/env/lib/python3.13/site-packages/pluggy/_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
  File "/Users/paul/.dev/techmatters/soil-id-algorithm/env/lib/python3.13/site-packages/_pytest/config/__init__.py", line 1140, in pytest_cmdline_parse
    self.parse(args)
    ~~~~~~~~~~^^^^^^
  File "/Users/paul/.dev/techmatters/soil-id-algorithm/env/lib/python3.13/site-packages/_pytest/config/__init__.py", line 1494, in parse
    self._preparse(args, addopts=addopts)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/paul/.dev/techmatters/soil-id-algorithm/env/lib/python3.13/site-packages/_pytest/config/__init__.py", line 1384, in _preparse
    self.known_args_namespace = self._parser.parse_known_args(
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        args, namespace=copy.copy(self.known_args_namespace)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/paul/.dev/techmatters/soil-id-algorithm/env/lib/python3.13/site-packages/_pytest/config/argparsing.py", line 158, in parse_known_args
    return self.parse_known_and_unknown_args(args, namespace=namespace)[0]
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/paul/.dev/techmatters/soil-id-algorithm/env/lib/python3.13/site-packages/_pytest/config/argparsing.py", line 172, in parse_known_and_unknown_args
    optparser = self._getparser()
  File "/Users/paul/.dev/techmatters/soil-id-algorithm/env/lib/python3.13/site-packages/_pytest/config/argparsing.py", line 131, in _getparser
    arggroup.add_argument(*n, **a)
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.13/3.13.0_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/argparse.py", line 1464, in add_argument
    raise ValueError('%r is not callable' % (type_func,))
ValueError: 'int' is not callable

You can see the same error on Linux:
https://github.com/techmatters/soil-id-algorithm/actions/runs/11389952437/job/31690457724?pr=197

Configuration

macOS 15.0.1
Python 3.13.0 (via Homebrew)

or

Ubuntu 24.04
Python 3.12.4

@mgu
Copy link

mgu commented Oct 17, 2024

Same issue on my side (python 3.12.4)
I guess the bug is here, we should have type=int.

I'm just wondering why it appears only now 😄
The code is "new", even if it is 6 years old

@vik748
Copy link

vik748 commented Oct 18, 2024

@jonbannister FYI...

@jonbannister
Copy link
Contributor

Thanks for raising, sorry about that. I have yanked pytest-profiling==1.8.0 and will ensure we have test coverage up to py3.13 before 1.8.1 is released. Please let me know if there are any further issues!

vladvildanov pushed a commit to redis/redis-py that referenced this issue Oct 21, 2024
@paulschreiber
Copy link
Author

@jonbannister Do you have an ETA for 1.8.1?

@jonbannister
Copy link
Contributor

pytest-profling==1.8.1 has been released, please let us know if there are any further issues.

@paulschreiber
Copy link
Author

Confirmed this is fixed in 1.8.1.

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 a pull request may close this issue.

4 participants