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
Bruno Oliveira
c1bdff9e69
Merge pull request #8494 from nicoddemus/python-3.10
2021-03-27 11:32:31 -03:00
Bruno Oliveira
b2954e85d6
Adjust message for Python 3.10
...
Now the message includes the class name ("Skip.__init__() got multiple...").
2021-03-27 11:13:16 -03:00
Bruno Oliveira
d9f4cedf17
Merge pull request #8472 from bluetech/rm-unnecessary-py-path-4
...
testing: stop relying on comparing to py.path in fnmatcher tests
2021-03-26 07:43:37 -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
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
945cc0b5a1
testing: stop relying on comparing to py.path in fnmatcher tests
2021-03-20 21:58:45 +02: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
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
pre-commit-ci[bot]
da4abd1c82
[pre-commit.ci] auto fixes from pre-commit.com hooks
...
for more information, see https://pre-commit.ci
2021-03-16 19:10:55 +00:00
Petr Viktorin
43b451e95e
Add tests for the error message
2021-03-16 20:09:17 +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
Ran Benita
f2d65c85f4
code: export ExceptionInfo for typing purposes
...
This type is most prominent in `pytest.raises` and we should allow to
refer to it by a public name.
The type is not in a perfectly "exposable" state. In particular:
- The `traceback` property with type `Traceback` which is derived from
the `py.code` API and exposes a bunch more types transitively. This
stuff is *not* exported and probably won't be.
- The `getrepr` method which probably should be private.
But they're already used in the wild so no point in just hiding them
now.
The __init__ API is hidden -- the public API for this are the `from_*`
classmethods.
2021-03-13 15:59:44 +02:00
Ran Benita
c9867bcc9d
Merge pull request #8416 from pytest-dev/pre-commit-ci-update-config
...
[pre-commit.ci] pre-commit autoupdate
2021-03-11 09:17:40 +02:00
Ronny Pfannschmidt
dbed1ff68f
adopt main terminology in the configs
...
ref pytest-dev/meta#8
2021-03-09 22:35:34 +01:00
Anthony Sottile
7a6ec5616d
clean up mkdtemp usage
...
Committed via https://github.com/asottile/all-repos
2021-03-08 19:12:08 -08:00
pre-commit-ci[bot]
ddde3266c6
[pre-commit.ci] auto fixes from pre-commit.com hooks
...
for more information, see https://pre-commit.ci
2021-03-08 16:55:59 +00:00
Anthony Sottile
79b03ce8db
Merge pull request #8411 from RonnyPfannschmidt/example-outcomes-check
...
fix bug in test for issue 519
2021-03-07 08:17:34 -08:00
Ronny Pfannschmidt
412fc001a0
fix bug in test for issue 519
...
assert the actual outcome and fix the filename
2021-03-07 15:01:39 +01:00
Ronny Pfannschmidt
77cb110258
drop usage of py.path.local calls
...
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2021-03-06 21:32:03 +01:00
Ronny Pfannschmidt
22dad53a24
implement Node.path as pathlib.Path
...
* reorganize lastfailed node sort
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2021-03-06 21:32:03 +01:00
Alexandros Tzannes
19a2f7425d
Merge pull request #8399 from atzannes/master
...
closes #8394
Generated fixture names for unittest/xunit/nose should start with underscore
2021-03-04 22:45:57 +02:00
Ran Benita
6e7dc8bac8
Merge pull request #8357 from matthewhughes934/remove-tmpdir-from-tests
...
Remove tmpdir from tests
2021-03-04 18:34:19 +02:00
Florian Bruhin
c14a9adba3
Fix skip signature ( #8392 )
...
* Fix test_strict_and_skip
The `--strict` argument was removed in #2552 , but the removal wasn't
actually correct - see #1472 .
* Fix argument handling in pytest.mark.skip
See #8384
* Raise from None
* Fix test name
2021-03-04 11:56:21 +01:00
Bruno Oliveira
bc0af99e5e
Merge pull request #8383 from pytest-dev/dependabot/pip/testing/plugins_integration/twisted-21.2.0
...
build(deps): bump twisted from 20.3.0 to 21.2.0 in /testing/plugins_integration
2021-03-02 17:33:35 -03:00
dependabot[bot]
897b5a3bd6
build(deps): bump twisted in /testing/plugins_integration
...
Bumps [twisted](https://github.com/twisted/twisted ) from 20.3.0 to 21.2.0.
- [Release notes](https://github.com/twisted/twisted/releases )
- [Changelog](https://github.com/twisted/twisted/blob/twisted-21.2.0/NEWS.rst )
- [Commits](https://github.com/twisted/twisted/compare/twisted-20.3.0...twisted-21.2.0 )
Signed-off-by: dependabot[bot] <support@github.com>
2021-03-01 03:02:50 +00:00
dependabot[bot]
62ef875796
build(deps): bump anyio[curio,trio] in /testing/plugins_integration
...
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio ) from 2.1.0 to 2.2.0.
- [Release notes](https://github.com/agronholm/anyio/releases )
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst )
- [Commits](https://github.com/agronholm/anyio/compare/2.1.0...2.2.0 )
Signed-off-by: dependabot[bot] <support@github.com>
2021-03-01 03:02:48 +00:00
Simon K
b7f2d7ca61
Fixed an issue where `getpass.getuser()` contained illegal characters for file directories ( #8365 )
...
* retry writing pytest-of dir when invalid chars are in directory name
* add unit tests for getbasetemp() and changelog
* patch _basetemp & _given_basetemp for testing basetemp()
* Tweak changelog for #8317 , tidy up comments
2021-02-25 08:28:57 +00:00
Matthew Hughes
514f8e0680
fixup! Rename variables 'tmpdir'->'tmp_path'
2021-02-24 20:55:35 +00:00
pre-commit-ci[bot]
3b7fc2c9c8
[pre-commit.ci] auto fixes from pre-commit.com hooks
...
for more information, see https://pre-commit.ci
2021-02-23 17:02:50 +00:00
Florian Bruhin
54a154c86f
Allow Class.from_parent to forward custom parameters to the constructor
...
Similarly to #7143 , at work we have a project with a custom pytest.Class
subclass, adding an additional argument to the constructor.
All from_parent implementations in pytest accept and forward *kw, except
Class (before this change) and DoctestItem - since I'm not familiar with
doctest support, I've left the latter as-is.
2021-02-23 18:00:56 +01:00
dependabot[bot]
060cbef260
build(deps): bump django in /testing/plugins_integration
...
Bumps [django](https://github.com/django/django ) from 3.1.6 to 3.1.7.
- [Release notes](https://github.com/django/django/releases )
- [Commits](https://github.com/django/django/compare/3.1.6...3.1.7 )
Signed-off-by: dependabot[bot] <support@github.com>
2021-02-22 03:01:27 +00:00
Matthew Hughes
c9bb4c418f
fixup! Rename variables 'tmpdir'->'tmp_path'
...
* Add some more of these
* Also reintroduce+rename instances of fixture usages that were
'tmpdir'->'tmp_path'
2021-02-21 13:10:07 +00:00
Matthew Hughes
09d4c5e30a
Rename variables 'tmpdir'->'tmp_path'
...
Rename this variables reflecting the migrations made with 3bcd316f0
and
ed658d682
2021-02-20 18:24:58 +00:00
Matthew Hughes
0e5e4e03e6
Remove some unused 'tmpdir's
2021-02-20 18:01:42 +00:00
Ran Benita
1003beaffa
Merge pull request #8323 from bluetech/setupstate-refactor-3
...
runner: a few more tweaks to SetupState
2021-02-08 13:56:04 +02:00
Bruno Oliveira
7b91302b33
Merge branch 'master' into dependabot/pip/testing/plugins_integration/django-3.1.6
2021-02-08 08:03:23 -03:00
dependabot[bot]
ef14f286a3
build(deps): bump django in /testing/plugins_integration
...
Bumps [django](https://github.com/django/django ) from 3.1.5 to 3.1.6.
- [Release notes](https://github.com/django/django/releases )
- [Commits](https://github.com/django/django/compare/3.1.5...3.1.6 )
Signed-off-by: dependabot[bot] <support@github.com>
2021-02-08 03:02:01 +00:00
dependabot[bot]
e8d7a7b843
build(deps): bump anyio[curio,trio] in /testing/plugins_integration
...
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio ) from 2.0.2 to 2.1.0.
- [Release notes](https://github.com/agronholm/anyio/releases )
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst )
- [Commits](https://github.com/agronholm/anyio/compare/2.0.2...2.1.0 )
Signed-off-by: dependabot[bot] <support@github.com>
2021-02-08 03:01:58 +00:00
Ran Benita
f42b68ccaa
runner: rename SetupState.prepare -> setup
...
This is the usual terminology we use, and matches better with
`teardown_exact()` and `pytest_runtest_setup()`.
2021-02-06 20:46:08 +02:00
Ran Benita
afea190797
Remove some no longer needed type-ignores
2021-01-29 20:40:43 +02:00
Bruno Oliveira
6a5d47a243
Merge pull request #8260 from nicoddemus/faulthandler-mode-X-8258
2021-01-28 13:03:24 -03:00
Bruno Oliveira
33861098d9
Only re-enable fauthandler during unconfigure if it was enabled before
2021-01-25 12:28:00 -03:00