-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[async-function-with-timeout] Disable check for asyncio before Python 3.11 (ASYNC109) #13023
Conversation
…ython3.11 (ASYNC109)
CodSpeed Performance ReportMerging #13023 will improve performances by 10.62%Comparing Summary
Benchmarks breakdown
|
|
Thanks. This does make sense to me. However, it does mean that the rule now deviates from the upstream rule (I'm not sure if It would be great if we can add a test demonstrating that this is working as expected (flags asyncio but not anyio) You can add the test here ruff/crates/ruff_linter/src/rules/flake8_async/mod.rs Lines 18 to 39 in 45f459b
and you can use the code below (you have to change the path to the python file) #[test]
fn async109_python_310_or_odler() -> Result<()> {
let diagnostics = test_path(
Path::new("flake8_async").join("path_to_test_File"),
&LinterSettings {
target_version: PythonVersion::Py310,
..LinterSettings::for_rule(Rule::AsyncFunctionWithTimeout)
},
)?;
assert_messages!(diagnostics);
Ok(())
} |
Yeah, this change definitely makes sense to me! There are third-party libraries backporting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect. Let's add a test and then merge this
Some (occasionally tangential) discussion is found here: #12353
Summary
Before, the diagnostic was raised for all supported versions of Python. However,
asyncio
only introducedasyncio.timeout
in python version 3.11.Now, the diagnostic is not raised when using
asyncio
with Python versions before 3.11Test Plan
It's a policy tweak leveraging well-tested library features. I don't see an obvious need for an additional test, but I would be happy to receive guidance on how to add a test.