You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider the following code snippet which overrides the default requests_mock pytest fixture with InvalidRequest being raised on unknown requests, so it needs to import the requests_mock package with the same name first in order to access certain exports like Mocker, ANY, or the exceptions submodule:
Apparently, ruff doesn't handle the renamed import correctly. When renaming the pytest fixture function or the fixture argument, which both can't be done because it's a global fixture override in our test code, then ruff doesn't raise an error.
F823 wasn't an issue in 0.0.272 but it now is after upgrading to 0.0.280. The last modification of that rule was in #6036.
The text was updated successfully, but these errors were encountered:
## Summary
We have some code to ensure that if an aliased import is used, any
submodules should be marked as used too. This comment says it best:
```rust
// If the name of a submodule import is the same as an alias of another import, and the
// alias is used, then the submodule import should be marked as used too.
//
// For example, mark `pyarrow.csv` as used in:
//
// ```python
// import pyarrow as pa
// import pyarrow.csv
// print(pa.csv.read_csv("test.csv"))
// ```
```
However, it looks like when we go to look up `pyarrow` (of `import
pyarrow as pa`), we aren't checking to ensure the resolved binding is
_actually_ an import. This was causing us to attribute `print(rm.ANY)`
to `def requests_mock` here:
```python
import requests_mock as rm
def requests_mock(requests_mock: rm.Mocker):
print(rm.ANY)
```
Closes#6180.
Consider the following code snippet which overrides the default
requests_mock
pytest fixture withInvalidRequest
being raised on unknown requests, so it needs to import therequests_mock
package with the same name first in order to access certain exports likeMocker
,ANY
, or theexceptions
submodule:Apparently, ruff doesn't handle the renamed import correctly. When renaming the pytest fixture function or the fixture argument, which both can't be done because it's a global fixture override in our test code, then ruff doesn't raise an error.
F823
wasn't an issue in0.0.272
but it now is after upgrading to0.0.280
. The last modification of that rule was in #6036.The text was updated successfully, but these errors were encountered: