aboutcode-org / aboutcode-org/skeleton

Configuring pytest to pick up "*.py" accidentally pulls in setup.py

未关闭
#88 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
9
派生
9
PR 合并指标
30 天内没有已合并 PR

描述

As noted in NexB/saneyaml#15, the `pytest` configuration in `pyproject.toml` currently configures it to pick up `*.py`:

https://github.com/nexB/skeleton/blob/acf94b360d675087195b7f216f4bee4401609729/pyproject.toml#L10
https://github.com/nexB/skeleton/blob/acf94b360d675087195b7f216f4bee4401609729/pyproject.toml#L43

This causes it to pick up the `setup.py` file as a potential test file, and even though it will contain no tests, importing `setup.py` during testing can have unwanted side effects. (For one, it makes `setuptools` a dependency of the test environment, where it would otherwise normally not be.)

Unfortunately, reading through [the pytest documentation](https://docs.pytest.org/en/8.2.x/reference/reference.html#ini-options-ref), it doesn't seem as though there's an easy way to exclude specific files once they've been caught up in an inclusion glob.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。