Allow ipytest cell magic (#13745)

## Summary

fixes: #13718 

## Test Plan

Using the notebook as mentioned in
https://github.com/astral-sh/ruff/issues/13718#issuecomment-2410631674,
this PR does not give the "F821 Undefined name `test_sorted`"
diagnostic.
This commit is contained in:
Dhruv Manilawala 2024-10-14 15:48:33 +05:30 committed by GitHub
parent 814ab47582
commit 5caabe54b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -238,9 +238,19 @@ impl Cell {
//
// This is to avoid false positives when these variables are referenced
// elsewhere in the notebook.
//
// Refer https://github.com/astral-sh/ruff/issues/13718 for `ipytest`.
!matches!(
command,
"capture" | "debug" | "prun" | "pypy" | "python" | "python3" | "time" | "timeit"
"capture"
| "debug"
| "ipytest"
| "prun"
| "pypy"
| "python"
| "python3"
| "time"
| "timeit"
)
})
}