Skip to content

Commit

Permalink
Add test for trio
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser committed Aug 23, 2024
1 parent 23adf32 commit 3921a32
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
7 changes: 4 additions & 3 deletions crates/ruff_linter/src/rules/flake8_async/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ mod tests {
Ok(())
}

#[test]
fn async109_python_310_or_older() -> Result<()> {
#[test_case(Path::new("ASYNC109_0.py"))]
#[test_case(Path::new("ASYNC109_1.py"))]
fn async109_python_310_or_older(path: &Path) -> Result<()> {
let diagnostics = test_path(
Path::new("flake8_async").join("ASYNC109_1.py"),
Path::new("flake8_async").join(path),
&LinterSettings {
target_version: PythonVersion::Py310,
..LinterSettings::for_rule(Rule::AsyncFunctionWithTimeout)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
---

Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
---
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
---
ASYNC109_0.py:8:16: ASYNC109 Async function definition with a `timeout` parameter
|
8 | async def func(timeout):
| ^^^^^^^ ASYNC109
9 | ...
|
= help: Use `trio.fail_after` instead

ASYNC109_0.py:12:16: ASYNC109 Async function definition with a `timeout` parameter
|
12 | async def func(timeout=10):
| ^^^^^^^^^^ ASYNC109
13 | ...
|
= help: Use `trio.fail_after` instead

0 comments on commit 3921a32

Please sign in to comment.