Ran Benita
6c0b6c2f92
Merge pull request #11941 from bluetech/doctest-parsefactories
...
doctest: fix autouse fixtures possibly not getting picked up
2024-02-07 22:09:17 +02:00
Ran Benita
9cd14b4ffb
doctest: fix autouse fixtures possibly not getting picked up
...
Fix #11929 .
Figured out what's going on. We have the following collection tree:
```
<Dir pyspacewar>
<Dir src>
<Package pyspacewar>
<Package tests>
<DoctestModule test_main.py>
<DoctestItem pyspacewar.tests.test_main.doctest_main>
```
And the `test_main.py` contains an autouse fixture (`fake_game_ui`) that
`doctest_main` needs in order to run properly. The fixture doesn't run!
It doesn't run because nothing collects the fixtures from (calls
`parsefactories()` on) the `test_main.py` `DoctestModule`.
How come it only started happening with commit
ab63ebb3dc07b89670b96ae97044f48406c44fa0? Turns out it mostly only
worked accidentally. Each `DoctestModule` is also collected as a normal
`Module`, with the `Module` collected after the `DoctestModule`. For
example, if we add a non-doctest test to `test_main.py`, the collection
tree looks like this:
```
<Dir pyspacewar>
<Dir src>
<Package pyspacewar>
<Package tests>
<DoctestModule test_main.py>
<DoctestItem pyspacewar.tests.test_main.doctest_main>
<Module test_main.py>
<Function test_it>
```
Now, `Module` *does* collect fixtures. When autouse fixtures are
collected, they are added to the `_nodeid_autousenames` dict.
Before ab63ebb3dc
, `DoctestItem` consults
`_nodeid_autousenames` at *setup* time. At this point, the `Module` has
collected and so it ended up picking the autouse fixture (this relies on
another "accident", that the `DoctestModule` and `Module` have the same
node ID).
After ab63ebb3dc
, `DoctestItem` consults
`_nodeid_autousenames` at *collection* time (= when it's created). At
this point, the `Module` hasn't collected yet, so the autouse fixture is
not picked out.
The fix is simple -- have `DoctestModule.collect()` call
`parsefactories`. From some testing I've done it shouldn't have negative
consequences (I hope).
2024-02-07 21:53:51 +02:00
dependabot[bot]
4c894f20a1
build(deps): Bump django in /testing/plugins_integration ( #11946 )
...
Bumps [django](https://github.com/django/django ) from 5.0 to 5.0.2.
- [Commits](https://github.com/django/django/compare/5.0...5.0.2 )
---
updated-dependencies:
- dependency-name: django
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-07 15:37:56 -03:00
Ran Benita
6e5008f19f
doctest: don't open code the module import
...
Currently, `DoctestModule` does `import_path` on its own. This changes
it to use `importtestmodule` as `Module` does. The behavioral changes
are:
- Much better error messages on import errors.
- Handles a few more error cases (see `importtestmodule`). This
technically expands the cover of `--doctest-ignore-import-errors` but
I think it makes sense.
- Considers `pytest_plugins` in the module.
- Populates `self.obj` as properly (without double-imports) as is
expected from a `PyCollector`.
This is also needed for the next commit.
2024-02-06 23:46:23 +02:00
Pierre Sassoulas
b9d02c5b53
Merge pull request #11932 Add pre-commit hook and fix pyproject.toml
...
- [pyproject-fmt] Add pre-commit hook and autofix existing
- Proper setuptools version for pyproject.toml
2024-02-06 15:14:07 +01:00
Pierre Sassoulas
d1095426c1
Update setuptools version to the one that support pyproject.toml
2024-02-06 14:40:31 +01:00
Pierre Sassoulas
757778f5f6
[pyproject-fmt] Add pre-commit hook and autofix existing
2024-02-06 14:40:31 +01:00
Pierre Sassoulas
404d31a942
Merge pull request #11930 from Pierre-Sassoulas/setup.cfg-to-pyproject.toml
...
Migration from ``setup.cfg`` to ``pyproject.toml``
2024-02-05 22:40:44 +01:00
Pierre Sassoulas
0d91539614
Merge pull request #11935 from pytest-dev/pre-commit-ci-update-config
...
[pre-commit.ci] pre-commit autoupdate
2024-02-05 21:46:11 +01:00
pre-commit-ci[bot]
835e8032f4
[pre-commit.ci] pre-commit autoupdate
...
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.1.15 → v0.2.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.15...v0.2.0 )
2024-02-05 20:29:38 +00:00
Pierre Sassoulas
c76ea72331
[pyproject.toml] Moving 'package_data' (py.typed) from setup.cfg
2024-02-05 21:04:33 +01:00
Pierre Sassoulas
dab1583ce1
[pyproject.toml] Remove setup_requires / package_dir in setup.cfg already exists
2024-02-05 21:04:12 +01:00
Pierre Sassoulas
411c2cbf9d
[pyproject.toml] Translate dynamic option to pyproject.toml
2024-02-05 21:03:28 +01:00
Pierre Sassoulas
c3583dee0b
[pyproject.toml] Translate 'metadata:platforms' to pyproject.toml
2024-02-05 21:03:26 +01:00
Pierre Sassoulas
a1d99e4bdd
[pyproject.toml] Move information from setup.cfg to pyproject.toml
2024-02-05 21:02:32 +01:00
Ran Benita
aaa9ca7327
Merge pull request #11918 from pytest-dev/update-plugin-list/patch-20b18f0f9
...
[automated] Update plugin list
2024-02-05 13:49:09 +02:00
Ran Benita
29094983d7
Merge pull request #11923 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-django-4.8.0
...
build(deps): Bump pytest-django from 4.7.0 to 4.8.0 in /testing/plugins_integration
2024-02-05 13:32:11 +02:00
Ran Benita
b8e56557c6
Merge pull request #11925 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-sugar-1.0.0
...
build(deps): Bump pytest-sugar from 0.9.7 to 1.0.0 in /testing/plugins_integration
2024-02-05 13:31:50 +02:00
Ran Benita
304ccb4ad7
Merge pull request #11928 from bluetech/setup-cfg-cleanups
...
Some setup.cfg cleanups
2024-02-05 13:29:49 +02:00
Ran Benita
90634a6060
setup.cfg: remove `zip_safe`
...
The setuptools docs say it's obsolete and no longer needed:
https://setuptools.pypa.io/en/latest/deprecated/zip_safe.html#understanding-the-zip-safe-flag
2024-02-05 12:21:37 +02:00
Ran Benita
ccbae95ad4
setup.cfg: remove redundant `packages`/`py_modules`
...
The `package_dir` already achieves this.
2024-02-05 12:16:52 +02:00
Ran Benita
cd9b241047
setup.cfg: remove `[devpi:upload]` section
...
Not needed since bfe2cbe875
.
2024-02-05 12:08:21 +02:00
Ran Benita
5c67cb2cf5
setup.cfg: remove `[check-manifest]` section
...
Not used since 731c35fcab
.
2024-02-05 11:59:48 +02:00
Ran Benita
2fc7926bae
setup.cfg: remove `[build_sphinx]` section
...
Legacy thing that is no longer needed.
2024-02-05 11:59:32 +02:00
Ran Benita
79de84941a
setup.cfg: move mypy configuration from setup.cfg to pyproject.toml
...
TOML is a nicer format than the INI format setup.cfg uses.
2024-02-05 11:59:27 +02:00
Pierre Sassoulas
0d1f4c63fa
Merge pull request #11914 - Activate flake8-bugbear and flake8-pyi
2024-02-05 09:37:37 +01:00
dependabot[bot]
2d4e27daf2
build(deps): Bump pytest-sugar in /testing/plugins_integration
...
Bumps [pytest-sugar](https://github.com/Teemu/pytest-sugar ) from 0.9.7 to 1.0.0.
- [Release notes](https://github.com/Teemu/pytest-sugar/releases )
- [Changelog](https://github.com/Teemu/pytest-sugar/blob/main/CHANGES.rst )
- [Commits](https://github.com/Teemu/pytest-sugar/compare/v0.9.7...v1.0.0 )
---
updated-dependencies:
- dependency-name: pytest-sugar
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
2024-02-05 03:39:30 +00:00
dependabot[bot]
2e50788b6d
build(deps): Bump pytest-django in /testing/plugins_integration
...
Bumps [pytest-django](https://github.com/pytest-dev/pytest-django ) from 4.7.0 to 4.8.0.
- [Release notes](https://github.com/pytest-dev/pytest-django/releases )
- [Changelog](https://github.com/pytest-dev/pytest-django/blob/master/docs/changelog.rst )
- [Commits](https://github.com/pytest-dev/pytest-django/compare/v4.7.0...v4.8.0 )
---
updated-dependencies:
- dependency-name: pytest-django
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2024-02-05 03:39:23 +00:00
Pierre Sassoulas
3101c026b9
[flake8-bugbear] Remove hidden global state to import only once
2024-02-04 23:08:38 +01:00
Pierre Sassoulas
e193a263c7
[flake8-pyi] Add checks for flake8-pyi and fix existing
2024-02-04 19:27:23 +01:00
Pierre Sassoulas
4eb246d4e1
[flake8-bugbear] noqa B023 not bound by design
2024-02-04 19:27:23 +01:00
Pierre Sassoulas
41ff3584d7
[flake8-bugbear] Fixes a B017 we can actually fix and noqa the two others
2024-02-04 19:27:23 +01:00
Pierre Sassoulas
b62d4b3527
[flake8-bugbear] Remove misleading multiple characters in lstrip
...
See https://pylint.readthedocs.io/en/stable/user_guide/messages/error/bad-str-strip-call.html
2024-02-04 19:27:23 +01:00
Pierre Sassoulas
e7bab63537
[flake8-bugbear] noqa all the useless comparison that are justified
2024-02-04 19:27:23 +01:00
Pierre Sassoulas
52fba25ff9
[flake8-bugbear] Fix all the useless expressions that are justified
2024-02-04 19:27:23 +01:00
Pierre Sassoulas
fcb818b73c
[flake8-bugbear] Re-raise all exceptions with proper exception chaining
2024-02-04 19:27:23 +01:00
Pierre Sassoulas
7eef4619d5
[flake8-bugbear] Add checks from flake8 bugbear
2024-02-04 19:27:16 +01:00
Ran Benita
e28f35c296
Merge pull request #11915 from bluetech/compat-string-types
...
compat: a couple of minor cleanups
2024-02-04 16:51:43 +02:00
pytest bot
b28bb01c4e
[automated] Update plugin list
2024-02-04 00:19:52 +00:00
Ran Benita
3ba4095400
compat: inline helpers into `ascii_escaped`
...
The helpers don't add much.
2024-02-03 18:42:05 +02:00
Ran Benita
99e8129ba3
compat: get rid of STRING_TYPES
...
I think it only obfuscates the code, also calling `bytes` a string type
is pretty misleading in Python 3.
2024-02-03 18:38:38 +02:00
Ran Benita
20b18f0f9a
Merge pull request #11913 from bluetech/ruff-version-ignore
...
Ignore isort on _version.py
2024-02-02 21:55:40 +02:00
Ran Benita
cb5f738858
Ignore isort on _version.py
...
The file is generated. This makes `ruff src/` run cleanly (when not
running through pre-commit).
2024-02-02 21:29:30 +02:00
Pierre Sassoulas
5be64c31cb
Merge pull request #11912 from Pierre-Sassoulas/activate-ruff-checks
...
[pre-commit] Activate ruff checks and fix existing issues
2024-02-02 20:22:18 +01:00
Pierre Sassoulas
233ab89f13
[ruff] Fix all consider [*cats, garfield] instead of cats + [garfield]
2024-02-02 15:18:38 +01:00
Pierre Sassoulas
8967c527ff
[ruff] Activate use next(iter(x)) instead of list(x)[0] and fix issue
2024-02-02 15:18:38 +01:00
Pierre Sassoulas
180a16a344
[ruff] Fix ambiguous characters found in string and comment
2024-02-02 15:18:38 +01:00
Pierre Sassoulas
514376fe29
[ruff] Add ruff's check and autofix existing issues
2024-02-02 15:18:38 +01:00
Pierre Sassoulas
bdfc5c80d8
Merge pull request #11901 from Pierre-Sassoulas/migrate-from-isort-to-ruff
...
Migrate from ``autoflake``, ``black``, ``isort``, ``pyupgrade``, ``flake8`` and ``pydocstyle``, to ``ruff``
2024-02-02 09:42:07 +01:00
Pierre Sassoulas
9ef905e7a0
[.git-blame-ignore-revs] Add migration to ruff/ruff format and blacken-docs 2024's style
2024-02-02 09:28:09 +01:00