Skip to content

_TaskDecorator has no __wrapped__ attribute in v2.3.0 #23688

@ddeepwell

Description

@ddeepwell

Apache Airflow version

2.3.0 (latest released)

What happened

I run a unit test on a task which is defined using the task decorator. In the unit test, I unwrap the task decorator with the __wrapped__ attribute, but this no longer works in v2.3.0. It works in v2.2.5.

What you think should happen instead

I expect the wrapped function to be returned. This was what occurred in v2.2.5

When running pytest on the airflow v2.3.0 the following error is thrown:
AttributeError: '_TaskDecorator' object has no attribute '__wrapped__'

How to reproduce

Here's a rough outline of the code.

A module hello.py contains the task definition:

from airflow.decorators import task

@task
def hello_airflow():
    print('hello airflow')

and the test contains

from hello import hello_airflow

def test_hello_airflow():
    hello_airflow.__wrapped__()

Then run pytest

Operating System

Rocky Linux 8.5 (Green Obsidian)

Versions of Apache Airflow Providers

No response

Deployment

Virtualenv installation

Deployment details

No response

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions