facebook / facebook/pyrefly

Can't import from `tests.conftest`

Open
#3,005 8 comments 3 reactions 0 assignees View on GitHub
configuration needs-discussion quansight stale
Dominant language
Rust
Stars
7k
Forks
516
PR merge metrics
No merged PRs in 30d

Description

### Describe the Bug

I'm struggling to come up with a minimal reproducer for this one, so for now here's how it's showing up for me in Polars

- the repo is here: https://github.com/pola-rs/polars
- I'm in the `py-polars` folder, and have run `pyrefly check`
- here's my `pyproject.toml` section for pyrefly:

```toml
[tool.pyrefly]
project-includes = ["tests"]
```

Running `pyrefly check` there's a lot of errors that show up (as expected, they require other configuration options / fixes), but the one I want to report here is:

```
ERROR Cannot find module `tests.conftest` [missing-import]
--> tests/unit/utils/test_unstable.py:11:5
|
11 | from tests.conftest import PlMonkeyPatch
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
Looked in these locations (from config in `/home/marcogorelli/polars-dev/py-polars/pyproject.toml`):
Import root (inferred from project layout): "/home/marcogorelli/polars-dev/py-polars/src"
Site package path queried from interpreter: ["/home/marcogorelli/polars-dev/.venv/lib/python3.14/site-packages", "/home/marcogorelli/polars-dev/py-polars/src", "/home/marcogorelli/polars-dev/py-polars/runtime/polars-runtime-32"]
```

Why can it not just import from `tests`?

### Sandbox Link

_No response_

### (Only applicable for extension issues) IDE Information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.