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

Add async flag when wrapping async function (#111) #112

Merged
merged 6 commits into from
Nov 8, 2023

Conversation

soldag
Copy link
Contributor

@soldag soldag commented Oct 18, 2023

Python 3.11 uses inspect.iscoroutinefunction to determine whether a test needs to be awaited or not. Since the wrapper created by ddt doesn't have the async code flag, iscoroutinefunction returns False and it is not awaited causing the issue described in #111.

I added a simple fix by adding the async code flag to the wrapper if the original function is a coroutine function.

@soldag
Copy link
Contributor Author

soldag commented Nov 3, 2023

@wswld Any chance you can have a look at this? It currently block me from using ddt in my project and it's a simple fix.

@wswld wswld self-requested a review November 6, 2023 23:50
@wswld wswld linked an issue Nov 6, 2023 that may be closed by this pull request
@wswld
Copy link
Contributor

wswld commented Nov 6, 2023

@soldag hi, sorry for the wait.
Could you please try pinning Ubuntu version as was done here?
Hopefully that will resolve the 3.6/2.7 issue we're having

PS: Please mention me if any updates otherwise I'm not notified

@wswld
Copy link
Contributor

wswld commented Nov 7, 2023

@soldag never mind, I've updated the versions
Now tests run, but there is an issue with Python 3.7
Could you please look into it?

@soldag
Copy link
Contributor Author

soldag commented Nov 7, 2023

@wswld Thanks for looking into it. I forgot that IsolatedAsyncioTestCase was only introduced in python 3.8. I changed it to use aiounittest.AsyncTestCase. Hope that's fine for you.

Copy link
Contributor

@wswld wswld left a comment

Choose a reason for hiding this comment

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

@soldag looks good now, thanks

@wswld wswld merged commit f96c225 into datadriventests:master Nov 8, 2023
5 checks passed
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 this pull request may close these issues.

Async tests no longer work on python 3.11
2 participants