Skip to content

Test functions generated by functools.partial raise an internal error during collection #811

Closed
@nicoddemus

Description

@nicoddemus

As discussed in #740, the following test functions fail during collection:

import functools
def do_it(x):
    assert x == 2
test_foo = functools.partial(do_it, x=1)  
=================================== ERRORS ====================================
________________________ ERROR collecting test_foo.py _________________________
...\lib\inspect.py:752: in getargs
    raise TypeError('{!r} is not a code object'.format(co))
E   TypeError: <functools.partial object at 0x0000000003D37278> is not a code object
=============================== warning summary ===============================
WC2 X:\test_foo.py cannot collect 'test_foo' because it is not a function.
===================== 1 warnings, 1 error in 0.02 seconds =====================

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions