Rahul Kumaresan
245eefafcf
clarify documentation about tolerance setting in unittest.TestCase.assertAlmost() ( #8614 )
2021-05-05 14:23:39 +02:00
Tarcísio Fischer
b7416f7abd
Suggest numpy testing module on pytest approx docs ( #8615 )
...
Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
Co-authored-by: Tarcisio Fischer <tarcisio@esss.co>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2021-05-04 23:08:41 -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
Parth Patel
992c403fc8
Improve `iterparentnodeids` to consume `/` parts until the first `::` ( #8577 )
...
* Fix issue where TestCase.setUpClass is not called for test methods with a / in its name by checking if there is :: before the selected / or any :: after. Also added a test case for this.
* removed print statement that was added
* Change iterparentnodeids to consume / parts until the first ::. Then consider ::. Tests were changed to reflect this.
* Update changelog/8509.improvement.rst
Co-authored-by: Ran Benita <ran@unusedvar.com>
2021-04-29 17:02:43 +03:00
Nico Schlömer
9ef608ef76
"fix" a couple of http -> https redirects
...
Found with
urli-fix . -a http: -i pytest
2021-04-26 17:44:27 +02:00
Anthony Sottile
67af623d9e
Merge pull request #8227 from encukou/defensive-get_source
...
Make code.FormattedExcinfo.get_source more defensive
2021-04-24 19:42:53 -07:00
Miroslav Šedivý
fbe66244b8
Fix some typos, remove redundant words and escapes ( #8564 )
...
* doc: Fix typos, remove double words
* Remove redundant escapes in regex
2021-04-19 20:39:08 +00: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
Bruno Oliveira
af31c60db1
Merge pull request #8540 from hauntsaninja/assert310
2021-04-15 08:55:42 -03:00
pre-commit-ci[bot]
d200598de9
[pre-commit.ci] pre-commit autoupdate ( #8547 )
...
* [pre-commit.ci] pre-commit autoupdate
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ran Benita <ran@unusedvar.com>
2021-04-14 12:49:09 +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
41a90cd9fe
Merge pull request #8463 from RonnyPfannschmidt/workaround-8361
...
address #8361 - introduce hook caller wrappers that enable backward compat
2021-04-05 22:50:31 +02: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
Ran Benita
c49100cef8
tmpdir: prevent using a non-private root temp directory
...
pytest uses a root temp directory named `/tmp/pytest-of-<username>`. The
name is predictable, and the directory might already exists from a
previous run, so that's allowed.
This makes it possible for my_user to pre-create
`/tmp/pytest-of-another_user`, thus giving my_user control of
another_user's tempdir.
Prevent this scenario by adding a couple of safety checks. I believe
they are sufficient.
Testing the first check requires changing the owner, which requires
root permissions, so can't be unit-tested easily, but I checked it
manually.
2021-04-03 23:42:53 +03:00
Ran Benita
1278f8b97e
tmpdir: fix temporary directories created with world-readable permissions
...
(Written for a Unix system, but might be applicable to Windows as well).
pytest creates a root temporary directory under /tmp, named
`pytest-of-<username>`, and creates tmp_path's and other under it.
/tmp is shared between all users of the system.
This root temporary directory was created with 0o777&~umask permissions,
which usually becomes 0o755, meaning any user in the system could list
and read the files, which is undesirable.
Use 0o700 permissions instead. Also for subdirectories, because the root
dir is adjustable.
2021-04-03 23:42:53 +03:00
Ran Benita
0dd1e5b4f4
pathlib: inline ensure_reset_dir()
...
This is only used in TempPathFactory.getbasetemp(). We'll be wanting
further control/care there, so move it into there.
2021-04-03 23:42:53 +03:00
Ran Benita
78122a5304
pathlib: remove useless temporary variable
2021-04-03 23:42:53 +03:00
Ronny Pfannschmidt
deb5b5bd96
fix #8371 : fix stack-level
2021-04-02 00:58:05 +02:00
Miro Hrončok
778d2b2499
monkeypatch.syspath_prepend: Skip fixup_namespace_packages if pkg_resources not imported
...
Calling pkg_resources.fixup_namespace_packages() is only needed for packages
that use pkg_resources.declare_namespace() and hence they already imported
pkg_resources. When pkg_resources is not imported, we don't need to use it.
This avoids an unneeded runtime dependency on setuptools.
The code is tested by test_syspath_prepend_with_namespace_packages,
behavior should remain unchanged, hence no new test was added.
When people drop pkg_resources from sys.modules, they are on their own.
If someone has a actual use case making this valid to support,
they can come in and provide a test, a reference and a fix.
2021-04-01 20:24:21 +02:00
Ronny Pfannschmidt
bad1963697
fix #8361 : address review/quality comments
2021-03-29 22:29:35 +02: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
878a51ef53
Merge pull request #8493 from pytest-dev/docs-fix
...
tweak documentation of report's sections attribute
2021-03-26 07:47:38 -03:00
Bruno Oliveira
be8d63e33b
Increase truncation threshold with -v, disable with -vv
...
Fix #6682
Fix #8403
2021-03-26 07:05:30 -03:00
wim glenn
76ab94e4a0
fix some bunk formatting in the CollectReport, and reword the description of the 'sections' attribute
2021-03-25 22:25:19 -05:00
Bruno Oliveira
7dfaaa1e16
Merge pull request #8476 from symonk/cmdline-main-docs
...
Remove note on conftest.py files as part of pytest_cmdline_main hookspec
2021-03-25 17:23:24 -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
symonk
42ece0ca81
remove conftest note on pytest_cmdline_main, the hook is invoked
2021-03-21 20:06:18 +00:00
Ronny Pfannschmidt
4ddf6c647c
test warnings and fix invocation bugs
2021-03-20 23:39:38 +01:00
Ronny Pfannschmidt
2994022753
reshape typing for hook invocation proxying
2021-03-20 23:02:03 +01:00
Ronny Pfannschmidt
a550db4b6c
drop internal py.path.local objects from hook calls
2021-03-20 21:50:40 +01:00
Ronny Pfannschmidt
30f1b81eb2
address #8361 - introduce hook caller wrappers that enable backward compat
2021-03-18 23:08:03 +01:00
Ronny Pfannschmidt
ff6d5ae278
port the rest of the scripts/docs over to the main branch
2021-03-18 22:13:12 +01:00
Bruno Oliveira
35df3e68d5
Merge pull request #8459 from bluetech/unnecessary-py-path-3
2021-03-18 09:05:45 -03:00
Jürgen Gmach
fb481c7e6f
fix typo ( #8460 )
2021-03-18 12:34:01 +01:00
Ran Benita
4690e4c510
reports: support any PathLike instead of only Path, py.path
...
The goal is to avoid referring to the legacy py.path.
2021-03-18 10:23:48 +02:00
Ran Benita
202dd9f423
pytester: add & use our own copytree instead of py.path's
...
Fixes the TODO note.
2021-03-18 10:23:48 +02:00
Ran Benita
ccdadb64ea
main: add Session.startpath, make Session.startdir a property that can be deprecated
...
Same as in Config.
2021-03-18 10:23:48 +02:00
Ran Benita
6a174afdfe
terminal: move startdir attribute to a property that can be deprecated
...
Same as in Config.
2021-03-18 10:23:48 +02:00
Ran Benita
e515264eb1
Remove yet more unnecessary py.path uses
2021-03-18 10:23:48 +02:00
Ran Benita
fe215bda6b
Merge pull request #8446 from bluetech/unnecessary-py-path-2
...
More py.path removal work
2021-03-18 10:20:59 +02:00
Kale Kundert
dd3709718d
Merge pull request #8453 from encukou/rel-error-message
...
Fix value in error message about negative relative tolerance
2021-03-16 16:43:31 -04:00
Petr Viktorin
1f131afb07
Fix value in error message about negative relative tolerance
2021-03-16 18:54:52 +01:00
Ran Benita
f0c7043138
Remove/replace some more unnecessary uses of py.path
2021-03-15 10:39:44 +02:00
Ran Benita
a03ee02817
config: make `collect_ignore` accept any PathLike
...
The main reason is to remove a reference to `py.path`.
2021-03-15 10:39:32 +02:00
Ran Benita
b26d1bb18f
cacheprovider: add cache.mkdir() as a Path-returning replacement to makedir()
...
It is not possible to change a return type in a compatible way, so a new
method is added.
2021-03-15 10:39:31 +02:00
Ran Benita
59251e8a2a
Remove/replace some unneeded usages of py.path
2021-03-14 14:12:28 +02:00
Ran Benita
db539ed2b0
Merge pull request #8437 from bluetech/rm-typevar-prefix
...
Remove `_` prefix from TypeVars, expose ExceptionInfo
2021-03-13 19:01:29 +02:00
Pierre Mourlanne
af9f27a874
Approx decimal sequence mapping ( #8422 )
2021-03-13 16:01:23 +02:00