Ran Benita
f4e7b0d6e0
Remove deprecated `pytest_cmdline_preparse` hook
2024-01-02 12:20:47 +02:00
Ran Benita
385796ba49
Rework Session and Package collection
...
Fix #7777 .
2023-12-10 17:01:39 +02:00
Ran Benita
ef699f8c17
testing: remove a no longer necessary skip
...
pytest-xdist was released at 2019-02-15, seems enough time.
2023-11-30 19:53:31 +02:00
Patrick Lannigan
9dc1fc4523
Add verbosity_assertions and config.get_verbosity
...
Fixes #11387
2023-11-19 11:56:29 -03:00
Sharad Nair
7c7bdf4574
Sanitize ini-options default handling #11282 ( #11594 )
...
Fixes #11282
2023-11-11 13:08:18 -03:00
Jon Parise
7500fe44b2
Correct the spelling of ArgSource.INVOCATION_DIR ( #11333 )
...
Config.ArgsSource.INCOVATION_DIR remains as a backwards compatibility
alias.
2023-08-23 09:21:17 +00:00
Ran Benita
01ac13a77d
config: split _getconftestmodules and _loadconftestmodules
...
Previously, the `_getconftestmodules` function was used both to load
conftest modules for a path (during `pytest_load_initial_conftests`),
and to retrieve conftest modules for a path (during hook dispatch and
for fetching `collect_ignore`). This made things muddy - it is usually
nicer to have clear separation between "command" and "query" functions,
when they occur in separate phases.
So split into "load" and "get".
Currently, `gethookproxy` still loads conftest itself. I hope to change
this in the future.
2023-08-01 09:46:17 +03:00
Ran Benita
b41acaea12
Switch to new-style pluggy hook wrappers
...
Fix #11122 .
2023-07-14 22:47:48 +03:00
Zac Hatfield-Dodds
f4e3b4ad98
Drop Python 3.7
2023-06-30 14:55:42 -07:00
Ran Benita
a4a189ad99
Change PytestRemovedIn8Warning to error by default
...
Per our backward compatibility policy.
2023-06-23 16:42:24 +03:00
nondescryptid
a704605cf1
Fix encoding warnings
2023-06-20 04:55:39 -07:00
Ran Benita
4a1bba25b9
config: fallback confcutdir to rootpath if inipath is not set
...
Currently, if `--confcutdir` is not set, `inipath.parent` is used, and
if `initpath` is not set, then `confcutdir` is None, which means there
is no cutoff.
Having no cutoff is not great, it means we potentially start probing
stuff all the way up to the filesystem root directory. So let's add
another fallback, to `rootpath`, which is always something reasonable.
2023-05-30 19:52:59 +03:00
Chris Mahoney
4f3f36c396
Add alias `--config-file` to `-c` ( #11036 )
...
Fixes #11031
Signed-off-by: Chris Mahoney <chrismahoey@hotmail.com>
Co-authored-by: Chris Mahoney <chrismahoey@hotmail.com>
2023-05-26 07:56:18 -03:00
Ronny Pfannschmidt
407b330fe1
split up report header lines
...
i found it painful to read crammed in a single line
thus rootdir, config file and testpaths now have own lines
2023-03-17 21:58:26 +01:00
Yannick PÉROUX
af4143729f
Allow spaces in -p arguments ( #10658 )
2023-01-21 08:22:44 -03:00
Ran Benita
310b67b227
Drop attrs dependency, use dataclasses instead ( #10669 )
...
Since pytest now requires Python>=3.7, we can use the stdlib attrs
clone, dataclasses, instead of the OG package.
attrs is still somewhat nicer than dataclasses and has some extra
functionality, but for pytest usage there's not really a justification
IMO to impose the extra dependency on users when a standard alternative
exists.
2023-01-20 11:13:36 +02:00
Gergely Kalmár
adaa463ee3
Ignore editable installation modules ( #10231 )
...
Fixes #10230
2022-08-26 09:46:47 -03:00
Chris Wheeler
fab696dcd1
Add support for .pytest.ini as an alternative to pytest.ini
...
Closes #9987
2022-06-14 08:24:35 -03:00
Hugo van Kemenade
e54c6a1362
Document the --code-highlight default ( #9883 )
...
Also normalized all help text using the patterns:
* `One sentence help text`
* `First sentence of help. Second sentence of help.`
2022-05-31 16:32:51 -03:00
Tobias Diez
141b301d3d
Fix more tests
2022-03-29 12:34:15 +02:00
Bruno Oliveira
e38d1cac48
Improve error message for malformed pyproject.toml files
...
Including the file name is enough to let the user know what the problem is.
The same is not needed for `.ini` files because the error message includes the path to the file by default.
Fix #9730
2022-03-05 08:59:28 -03:00
Ran Benita
01e1de7a1a
Rename ``pythonpath`` plugin to ``python_path``
...
Fix #9636 .
2022-02-09 10:03:20 +02:00
Ran Benita
3f4eab3f8f
testing: avoid private pluggy attributes in test
2022-01-14 17:49:38 +02:00
Bruno Oliveira
696f955ff8
Split wrappers and non-wrappers in test_load_initial_conftest_last_ordering
...
Seems better to test which one is which explicitly.
2022-01-04 10:03:30 -03:00
Bruno Oliveira
4038752bf3
Ensure Config.inifile is available during pytest_cmdline_main
...
Fix #9396
2022-01-04 10:03:28 -03:00
Kian Meng, Ang
55debfad1f
Fix typos ( #9424 )
2021-12-27 09:23:15 -03:00
Ran Benita
ce7cff9f8e
Move pathlist support to legacypath plugin
2021-10-28 21:51:51 +03:00
Bruno Oliveira
f5fd2fb176
Improve UX during errors while parsing warning filters
...
Fix #7864
Fix #9218
Closes #8343
Closes #7877
2021-10-21 13:15:41 -03:00
Ran Benita
5059b31a73
Remove redundant explicit os.fspath calls
...
Python calls it on its own.
2021-10-09 13:44:44 +03:00
Brian Okken
c82bda259c
Add a `pythonpath` setting to allow paths to be added to `sys.path`. ( #9134 )
2021-10-05 09:36:38 +03:00
Simon K
d5c62d0326
Making `--debug` more configurable for the pytest user ( #8955 )
...
Close #8954
2021-07-30 17:37:38 -03:00
Bruno Oliveira
109312ba86
Make --version write to stdout rather than stderr
...
Fix #8246
2021-06-28 15:56:26 -03:00
Ran Benita
113a860a1f
argparsing: support parser.addini(type="paths") which returns pathlib.Paths
2021-05-07 09:58:51 +03:00
Florian Bruhin
e354c5c919
Fix warning filters used in tests
2021-05-04 17:25:02 +02:00
Abdelrahman Elbehery
9078c3ce23
fix #8464 wrong root dir when -c is passed ( #8537 )
...
fix #8464 wrong root dir when -c is passed
2021-04-16 14:38:35 -03:00
Tadeu Manoel
b706a2c048
Fix error with --import-mode=importlib and modules containing dataclasses or pickle ( #7870 )
...
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
Fixes #7856 , fixes #7859
2021-04-05 17:10:03 -03:00
Florian Bruhin
bc055e8e69
Fix required_plugins with prereleases ( #8469 )
...
* Fix required_plugins with prereleases
Fixes #8456
* Fix existing tests
* Update changelog/8456.bugfix.rst
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2021-03-21 22:51:12 +01:00
Ran Benita
59251e8a2a
Remove/replace some unneeded usages of py.path
2021-03-14 14:12:28 +02:00
Ronny Pfannschmidt
dbed1ff68f
adopt main terminology in the configs
...
ref pytest-dev/meta#8
2021-03-09 22:35:34 +01:00
Ran Benita
170a2c5040
testing/test_config: check inipath instead of inifile
...
inifile is soft-deprecated in favor of inipath.
2020-12-22 21:08:25 +02:00
Ran Benita
ed658d6829
Some py.path.local -> pathlib.Path
...
- Some conftest related functions
- _confcutdir
- Allow arbitrary os.PathLike[str] in gethookproxy.
2020-12-12 17:33:28 +02:00
Anton
810b878ef8
Migrate to pytester: test_capture.py, test_terminal.py, approx.py ( #8108 )
...
* Migrate to pytester: test_capture.py, test_config.py, approx.py
* migrate test_terminal.py
* revert test_config.py
* more typing in test_terminal.py
* try-out 'tr' fixture update
* revert 'tr' fixture, update test_config.py
2020-12-08 22:20:02 +02:00
Kyle Altendorf
76acb44330
Update tests to cover explicit None and "string" as addini() types
2020-10-07 17:56:54 -04:00
Anthony Sottile
33d119f71a
py36+: com2ann
2020-10-05 18:33:17 -07:00
Anthony Sottile
66bd44c13a
py36+: pyupgrade: py36+
2020-10-03 12:46:54 -07:00
Anthony Sottile
fb1d550aac
py36+: remove rexport of Path and PurePath
2020-10-03 12:16:52 -07:00
Anthony Sottile
bfadd4060e
py36+: from typing import Type: no longer need guard
2020-10-02 19:50:10 -07:00
Anthony Sottile
a238d1f37d
py36+: remove TYPE_CHECKING from _pytest.compat
...
automated with:
```bash
git grep -l 'from .* import TYPE_CHECKING' |
xargs reorder-python-imports \
--application-directories .:src \
--remove-import 'from _pytest.compat import TYPE_CHECKING' \
--add-import 'from typing import TYPE_CHECKING'
```
2020-10-02 15:03:24 -07:00
Ran Benita
4a9192f727
findpaths: fix regression causing incorrect rootdir to be determined
...
When switching from py.path.local to pathlib (70f3ad1c1f
),
`local.parts(reverse=True)` was translated incorrectly, leading to the
wrong rootdir being determined in some non-trivial cases where parent
directories have config files as well.
2020-09-28 19:13:01 +03:00
Sorin Sbarnea
b031a7cecf
Smoke tests for assorted plugins ( #7721 )
...
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Kyle Altendorf <sda@fstab.net>
2020-09-19 15:56:52 -03:00