aspect-build / aspect-build/rules_py
[Bug]: The tests parent directory (`"."`) is added to the PYTHONPATH when using `py_pytest_main`
- Dominant language
- Starlark
- Stars
- 145
- Forks
- 97
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 71
Description
### What happened?
When using `py_pytest_main` the target's parent directory is added to the PYTHONPATH causing the same issues as in [https://github.com/aspect-build/rules_py/issues/368]().
### Version
Development (host) and target OS/architectures:
Output of `bazel --version`: bazel 8.0.0
Version of the Aspect rules, or other relevant rules from your
`WORKSPACE` or `MODULE.bazel` file:
```
bazel_dep(name = "rules_python", version = "1.0.0")
bazel_dep(name = "aspect_rules_py", version = "1.0.0", dev_dependency = True)
python_version = "3.10"
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
configure_coverage_tool = True,
is_default = True,
python_version = python_version,
)
use_repo(python, "python_3_10", "python_versions", "pythons_hub")
```
Language(s) and/or frameworks involved: python
### How to reproduce
```shell
py_pytest_main(
name = "__test__",
deps = ["@pip//pytest"],
)
py_test(
name = "my_test",
srcs = ["my_test.py", "//:__test__"],
main = "__test__.py",
deps = [
"//:__test__",
"@pip//pytest",
],
)
```
If `my_test.py` has an import for e.g. `concurrent.futures` and there is a `concurrent.py` in the same directory it will cause a clash.
```
### Any other information?
_No response_
```
Contributor guide
Assessment
This issue has not been assessed yet.