Ran Benita
7431750bb6
doc: have tighter control on what autodoc shows
...
New versions of sphinx starting showing `__init__` parameters even when
we don't want them to show because they are private (have `_ispytest`
argument).
The only working solution I found was to switch to
`autodoc_typehints_description_target = "documented"` and explicitly
document parameters for which we want to show the types. It's a little
tedious and repetitive in some simple cases, but overall it results in
nicer API docs.
2022-08-13 21:46:49 +03:00
Bruno Oliveira
334d6514c6
Fix mypy pre-commit run
...
This started to fail recently with:
```
mypy.....................................................................Failed
- hook id: mypy
- exit code: 1
src/_pytest/assertion/rewrite.py:284: error: Returning Any from function declared to return "TraversableResources" [no-any-return]
Found 1 error in 1 file (checked 219 source files)
```
Not sure why that started failing, but seems like ignoring that error specifically is OK.
2022-07-11 08:27:09 -03:00
Anthony Sottile
4cd0322ca1
replace atomicwrites with os.replace
2022-07-08 18:36:10 -07:00
Bruno Oliveira
f92c4a77ad
Use PurePath directly instead of os.path.sep in rewrite.py
...
Given we are already creating a `PurePath`, just pass the parts directly to it.
This avoids using `os.path.sep`, that although is an official API, seems not to be available in all systems.
Fix #9791
2022-06-26 21:29:05 -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
Anthony Sottile
8fa775bcee
fix comparison of dataclasses with `InitVar`
2022-04-08 19:51:05 -04:00
Samuel Colvin
b75cbee290
Remove newlines from left/right operands with '-vv' ( #9743 )
...
The left/right operands produced when `verbose > 1` should not contain newlines, because they are used to
build the `summary` string. The `assertrepr_compare` function returns a list of lines, and the summary is one of those lines and should not contain newlines itself.
Fix #9742
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2022-03-19 11:55:39 +00:00
Bruno Oliveira
fac8f284cd
Fix diff output for data types where `-v` would show less information ( #9661 )
...
Close #5192
2022-02-15 09:43:20 -03:00
pre-commit-ci[bot]
2073cce105
[pre-commit.ci] auto fixes from pre-commit.com hooks
...
for more information, see https://pre-commit.ci
2022-02-08 00:44:52 +02:00
Elijah DeLee
d45a19cfde
move function specific imports to function
...
re: review from @asottile that this should only get imported in the function
modify the else/if logic since inside the function we already know the python version is >= 3.10, and just have to know if it is 3.11 or greater
2022-02-08 00:44:52 +02:00
Bruno Oliveira
f86a87a315
Update src/_pytest/assertion/rewrite.py
...
Co-authored-by: Ran Benita <ran@unusedvar.com>
2022-02-08 00:44:52 +02:00
Bruno Oliveira
5f1a2f33da
Fix invalid importing of `importlib.reader` in Python 3.9
...
Fix #9608
2022-02-08 00:44:52 +02:00
Elijah DeLee
15ddccf700
importlib.readers not valid until python 3.10
...
This exists https://github.com/python/cpython/blob/3.10/Lib/importlib/readers.py and FileReader is in there
This is a 404 https://github.com/python/cpython/blob/3.9/Lib/importlib/readers.py
This change needs to get backported to the 7.0.z branch(s) too
Fixes https://github.com/pytest-dev/pytest/issues/9608
2022-02-08 00:44:52 +02:00
Hugo van Kemenade
1fd3601caa
Drop support for EOL Python 3.6
2021-12-30 12:37:18 +02:00
Ran Benita
b9663fed6f
Merge pull request #9442 from hramezani/drop_python_36
...
Drop Python3.6 in CI, setup.cfg, and readme.
2021-12-30 12:22:13 +02:00
Hasan Ramezani
b72ad0fa8e
Remove has_flags conditions from src._pytest.assertion.rewrite._read_pyc
2021-12-28 10:11:45 +01:00
Hasan Ramezani
3d7cd77017
Update syntax to Python3.7+.
2021-12-28 10:11:35 +01:00
Kian Meng, Ang
55debfad1f
Fix typos ( #9424 )
2021-12-27 09:23:15 -03:00
Yuval Shimon
2d7905b13b
support pypy
2021-12-12 15:14:24 +02:00
Yuval Shimon
df74e5c532
fixing pre-commit
2021-12-12 14:53:29 +02:00
pre-commit-ci[bot]
9166ff6cb5
[pre-commit.ci] auto fixes from pre-commit.com hooks
...
for more information, see https://pre-commit.ci
2021-12-12 12:49:24 +00:00
Yuval Shimon
8c3b17263b
removing unnecessary changes
2021-12-12 14:47:00 +02:00
Yuval Shimon
a67c547536
fixing tests
2021-12-12 14:45:47 +02:00
Yuval Shimon
31f42ef83f
small fix
2021-12-12 14:40:46 +02:00
Yuval Shimon
897395afd5
fix 9326
2021-12-12 14:38:45 +02:00
pre-commit-ci[bot]
dd53cc7e38
[pre-commit.ci] auto fixes from pre-commit.com hooks
...
for more information, see https://pre-commit.ci
2021-12-06 21:12:33 +00:00
Ran Benita
14a879b6d1
Merge pull request #9183 from bluetech/rm-redundent-osfspath
...
Remove redundant explicit os.fspath calls
2021-10-09 19:14:55 +03:00
Bernát Gábor
3407fe63e2
Support the importlib.resources files API in rewritten files ( #9173 )
2021-10-09 10:54:44 -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
Bruno Oliveira
14b79a66a3
Merge pull request #9025 from davidszotten/more_verbose_for_ci
2021-10-05 16:52:47 -03:00
Ran Benita
6a5211f369
rewrite: fixup end_lineno, end_col_offset of rewritten asserts
...
These are new additions in Python 3.8:
https://docs.python.org/3/whatsnew/3.8.html#ast
I'm not sure what's using them but we should set them anyway.
2021-10-05 10:51:09 +03:00
Ran Benita
614f5394b5
Avoid `@lru_cache` on methods
...
The problem with `@lru_cache` on methods is that it also captures `self`
and leaks it until the entry is evicted (if ever).
2021-10-01 14:41:14 +03:00
David Szotten
d5c020d8c5
always show full diff in ci
...
follow-up to #1314 , for similar reasons
closes #9023
2021-08-19 20:17:43 +01:00
David Szotten
2367e6e9bf
refactor ci helper to prepare for re-use
2021-08-19 11:24:51 +00:00
Ran Benita
2aaea20cb2
Use {node,config}.stash instead of ._store
...
Use the public name. The `_store` name is only because some plugins
started using it anyway - will be removed at some point.
2021-07-24 17:40:08 +03:00
Ran Benita
5470d33e82
store: rename Store to Stash
...
The name "stash" is a bit more distinguishable and more evocative of the
intended usage.
2021-07-18 15:21:27 +03:00
Tarcísio Fischer
9d9b84d175
Improve pytest.approx error messages readability (Pull request) ( #8429 )
...
Improve pytest.approx error messages readability (Pull request)
2021-04-30 07:36:56 -03:00
hauntsaninja
e3dc34ee41
fixup comments
2021-04-12 11:34:14 -07:00
pre-commit-ci[bot]
da66f00413
[pre-commit.ci] auto fixes from pre-commit.com hooks
...
for more information, see https://pre-commit.ci
2021-04-11 22:44:33 +00:00
hauntsaninja
8be1628042
Fix assertion rewriting on Python 3.10
...
Fixes https://github.com/pytest-dev/pytest/issues/8539
This seems to have been the result of https://bugs.python.org/issue43798
2021-04-11 15:42:42 -07:00
Ronny Pfannschmidt
9052a9e313
Merge pull request #8462 from RonnyPfannschmidt/main_fixup_followup
...
port the rest of the scripts/docs over to the main branch
2021-03-27 15:49:20 +01:00
Bruno Oliveira
be8d63e33b
Increase truncation threshold with -v, disable with -vv
...
Fix #6682
Fix #8403
2021-03-26 07:05:30 -03:00
Ronny Pfannschmidt
ff6d5ae278
port the rest of the scripts/docs over to the main branch
2021-03-18 22:13:12 +01:00
Ran Benita
2cb34a99cb
Some py.path.local -> pathlib.Path
2020-12-15 00:29:13 +02:00
Ran Benita
1d532da49e
assertion/rewrite: write pyc's according to PEP-552 on Python>=3.7
...
Python 3.7 changes the pyc format by adding a flags byte. Even though it
is not necessary for us to match it, it is nice to be able to read pyc
files we emit for debugging the rewriter.
Update our custom pyc files to use that format. We write flags==0
meaning we still use the mtime+size format rather the newer hash format.
2020-11-14 23:20:12 +02:00
Karthikeyan Singaravelan
9a0f4e57ee
Add support to display field names in namedtuple diffs.
2020-10-31 14:41:53 +02:00
Ran Benita
5913cd20ec
assertion/util: remove unhelpful `type_fns` indirection
...
It doesn't serve any purpose that I am able to discern.
2020-10-30 21:15:48 +02:00
Hugo van Kemenade
a642650e17
Drop support for EOL Python 3.5
2020-10-19 10:02:36 +03: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