facebook / facebook/pyrefly

Pyrefly cannot find common test module

Open
#2,686 4 comments 0 reactions 0 assignees View on GitHub
configuration
Dominant language
Rust
Stars
7k
Forks
516
PR merge metrics
No merged PRs in 30d

Description

### Describe the Bug

Given the following folder hierarchy:

```
my_package/
`- __init__.py
tests/
+- common.py
`- test_my_package.py
pyproject.toml
```

If `test_my_package.py` tries to `import common`, running `pyrefly check` gives the following error:

```
ERROR Cannot find module `common` [missing-import]
--> tests/test_my_package.py:1:8
|
1 | import common
| ^^^^^^
|
Looked in these locations (from default config for project root marked by `/home/user/my_package/pyproject.toml`):
Import root (inferred from project layout): "/home/user/my_package"
Site package path queried from interpreter: ["/home/user/my_package/.venv/lib/python3.11/site-packages", "/home/user/my_package"]
```

Note that `pytest` is able to find the `common` module and runs fine.

### Versions

- OS: Linux
- Python: 3.11.2
- Pyrefly: 0.55.0

### 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.