Jakob van Santen
9ccbf5b899
python_api: handle array-like args in approx() ( #8137 )
2020-12-15 08:49:29 -03:00
Ran Benita
6c899a0afa
Merge pull request #8144 from bluetech/py-to-pathlib-4
...
hookspec: add pathlib.Path alternatives to py.path.local parameters in hooks
2020-12-15 13:06:06 +02:00
Anton
8eef8c6004
tests: Migrate to pytester - incremental update ( #8145 )
2020-12-15 13:02:32 +02:00
Ran Benita
592b32bd69
hookspec: add pathlib.Path alternatives to py.path.local parameters in hooks
...
As part of the ongoing migration for py.path to pathlib, make sure all
hooks which take a py.path.local also take an equivalent pathlib.Path.
2020-12-15 00:34:23 +02:00
Ran Benita
2cb34a99cb
Some py.path.local -> pathlib.Path
2020-12-15 00:29:13 +02:00
Bruno Oliveira
cb8142b8ec
Merge pull request #8139 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-html-3.1.1
...
build(deps): bump pytest-html from 3.1.0 to 3.1.1 in /testing/plugins_integration
2020-12-14 08:13:44 -03:00
dependabot[bot]
a09d8b1599
build(deps): bump pytest-html in /testing/plugins_integration
...
Bumps [pytest-html](https://github.com/pytest-dev/pytest-html ) from 3.1.0 to 3.1.1.
- [Release notes](https://github.com/pytest-dev/pytest-html/releases )
- [Changelog](https://github.com/pytest-dev/pytest-html/blob/master/CHANGES.rst )
- [Commits](https://github.com/pytest-dev/pytest-html/compare/v3.1.0...v3.1.1 )
Signed-off-by: dependabot[bot] <support@github.com>
2020-12-14 03:07:30 +00:00
dependabot[bot]
92b444a914
build(deps): bump pytest-bdd in /testing/plugins_integration
...
Bumps [pytest-bdd](https://github.com/pytest-dev/pytest-bdd ) from 4.0.1 to 4.0.2.
- [Release notes](https://github.com/pytest-dev/pytest-bdd/releases )
- [Changelog](https://github.com/pytest-dev/pytest-bdd/blob/master/CHANGES.rst )
- [Commits](https://github.com/pytest-dev/pytest-bdd/compare/4.0.1...4.0.2 )
Signed-off-by: dependabot[bot] <support@github.com>
2020-12-14 03:07:27 +00:00
antonblr
4ed9a38519
tests: Migrate testing/python to pytester fixture
2020-12-13 07:42:12 -08:00
Bruno Oliveira
7e2e6630ad
Merge pull request #8123 from nicoddemus/import-mismatch-unc
...
Compare also paths on Windows when considering ImportPathMismatchError
2020-12-13 10:35:11 -03:00
bot2x
28588bf535
migrates test_warnings.py from testdir to pytester
2020-12-13 14:13:49 +02:00
Ran Benita
37b154b1ec
Merge pull request #8122 from bluetech/py-to-pathlib-3
...
Some py.path.local -> pathlib.Path
2020-12-13 10:54:19 +02:00
Ran Benita
3302ff9949
terminal: when the skip/xfail is empty, don't show it as "()"
...
Avoid showing a line like
x.py::test_4 XPASS () [100%]
which looks funny.
2020-12-12 22:09:00 +02:00
Pedro Algarvio
b16c091253
Add `pytest_markeval_namespace` hook.
...
Add a new hook , `pytest_markeval_namespace` which should return a dictionary.
This dictionary will be used to augment the "global" variables available to evaluate skipif/xfail/xpass markers.
Pseudo example
``conftest.py``:
.. code-block:: python
def pytest_markeval_namespace():
return {"color": "red"}
``test_func.py``:
.. code-block:: python
@pytest.mark.skipif("color == 'blue'", reason="Color is not red")
def test_func():
assert False
2020-12-12 17:41:37 +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
Bruno Oliveira
572dfcd160
Compare also paths on Windows when considering ImportPathMismatchError
...
On Windows, os.path.samefile returns false for paths mounted in UNC paths which
point to the same location.
I couldn't reproduce the actual case reported, but looking at the code it seems
this commit should fix the issue.
Fix #7678
Fix #8076
2020-12-12 08:54:49 -03:00
Katarzyna
612f157dbd
Show reason for skipped test in verbose mode
2020-12-09 09:43:47 +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
Bruno Oliveira
059f6ff315
Merge pull request #8107 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-html-3.1.0
...
build(deps): bump pytest-html from 3.0.0 to 3.1.0 in /testing/plugins_integration
2020-12-07 08:52:56 -03:00
dependabot[bot]
19de6bccff
build(deps): bump pytest-html in /testing/plugins_integration
...
Bumps [pytest-html](https://github.com/pytest-dev/pytest-html ) from 3.0.0 to 3.1.0.
- [Release notes](https://github.com/pytest-dev/pytest-html/releases )
- [Changelog](https://github.com/pytest-dev/pytest-html/blob/master/CHANGES.rst )
- [Commits](https://github.com/pytest-dev/pytest-html/compare/v3.0.0...v3.1.0 )
Signed-off-by: dependabot[bot] <support@github.com>
2020-12-07 03:08:29 +00:00
dependabot[bot]
8c120c042c
build(deps): bump django in /testing/plugins_integration
...
Bumps [django](https://github.com/django/django ) from 3.1.3 to 3.1.4.
- [Release notes](https://github.com/django/django/releases )
- [Commits](https://github.com/django/django/compare/3.1.3...3.1.4 )
Signed-off-by: dependabot[bot] <support@github.com>
2020-12-07 03:08:29 +00:00
Ran Benita
e398c93884
Merge pull request #8055 from bluetech/unraisable
...
Add unraisableexception and threadexception plugins
2020-12-05 21:52:17 +02:00
Ran Benita
760a73c08c
Merge pull request #8017 from bluetech/typing-public-fixtures
...
Export types of builtin fixtures for type annotations
2020-12-05 21:51:20 +02:00
Christine Mecklenborg
eeb3afb8ab
Migrate test_pastebin.py from testdir to pytester
2020-12-01 12:55:59 -06:00
Ran Benita
64bb5f2ad1
Merge pull request #8091 from cmecklenborg/pytester_refactor_test_parseopt
...
Migrate test_parseopt.py from testdir to pytester
2020-12-01 14:10:09 +02:00
Ran Benita
0d0dfdd7aa
Merge pull request #8090 from cmecklenborg/pytester_refactor_test_nose
...
Migrate test_nose.py from testdir to pytester
2020-12-01 14:07:55 +02:00
dependabot[bot]
7a06bc2416
build(deps): bump pytest-flakes in /testing/plugins_integration ( #8087 )
...
Bumps [pytest-flakes](https://github.com/asmeurer/pytest-flakes ) from 4.0.2 to 4.0.3.
- [Release notes](https://github.com/asmeurer/pytest-flakes/releases )
- [Commits](https://github.com/asmeurer/pytest-flakes/commits )
Signed-off-by: dependabot[bot] <support@github.com>
2020-12-01 14:06:38 +02:00
Christine Mecklenborg
4abd71121d
Migrate test_parseopt.py from testdir to pytester
2020-11-30 16:27:39 -06:00
Christine Mecklenborg
d4c81ffab4
Migrate test_nose.py from testdir to pytester
2020-11-30 16:07:26 -06:00
Dominic Mortlock
775ba63c67
Refactor acceptance_test to use pytester ( #8070 )
2020-11-25 14:42:47 +02:00
Ran Benita
d50df85e26
Add unraisableexception and threadexception plugins
2020-11-21 21:11:48 +02:00
Maximilian Cosmo Sitter
0cef530d10
Add str() support to LineMatcher ( #8050 )
2020-11-21 20:45:20 +02:00
Simon K
52fef811c2
permit node to warn with any warning type, not just PytestWarning ( #8052 )
...
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-11-21 10:49:17 -03:00
Ran Benita
3e0bbd2f57
testing: fix ResourceWarning in broken-pipe test
2020-11-20 17:55:23 +02:00
Petter Strandmark
eda681af2b
Call Python 3.8 doClassCleanups ( #8033 )
2020-11-19 12:07:15 +02:00
Ran Benita
30d89fd07e
Merge pull request #8039 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-html-3.0.0
...
build(deps): bump pytest-html from 2.1.1 to 3.0.0 in /testing/plugins_integration
2020-11-19 12:05:04 +02:00
Garvit Shubham
6fe9d2fb9f
testing: convert test_{conftest,recwarn,tmpdir} to pytester
2020-11-16 19:22:57 +02:00
dependabot[bot]
3a899ced76
build(deps): bump pytest-html in /testing/plugins_integration
...
Bumps [pytest-html](https://github.com/pytest-dev/pytest-html ) from 2.1.1 to 3.0.0.
- [Release notes](https://github.com/pytest-dev/pytest-html/releases )
- [Changelog](https://github.com/pytest-dev/pytest-html/blob/master/CHANGES.rst )
- [Commits](https://github.com/pytest-dev/pytest-html/compare/v2.1.1...v3.0.0 )
Signed-off-by: dependabot[bot] <support@github.com>
2020-11-16 03:15:18 +00:00
Ran Benita
825b81ba52
Merge pull request #8014 from bluetech/pyc-pep552
...
assertion/rewrite: write pyc's according to PEP-552 on Python>=3.7
2020-11-14 23:38:45 +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
Ran Benita
f1e6fdcddb
Export types of builtin fixture for type annotations
...
In order to allow users to type annotate fixtures they request, the
types need to be imported from the `pytest` namespace. They are/were
always available to import from the `_pytest` namespace, but that is
not guaranteed to be stable.
These types are only exported for the purpose of typing. Specifically,
the following are *not* public:
- Construction (`__init__`)
- Subclassing
- staticmethods and classmethods
We try to combat them being used anyway by:
- Marking the classes as `@final` when possible (already done).
- Not documenting private stuff in the API Reference.
- Using `_`-prefixed names or marking as `:meta private:` for private
stuff.
- Adding a keyword-only `_ispytest=False` to private constructors,
warning if False, and changing pytest itself to pass True. In the
future it will (hopefully) become a hard error.
Hopefully that will be enough.
2020-11-13 11:25:09 +02:00
Ran Benita
66311ff702
Merge pull request #8022 from bluetech/doctest-init
...
main: fix only one doctest collected on pytest --doctest-modules __init__.py
2020-11-13 10:46:46 +02:00
Ran Benita
ea3c0aa245
Merge pull request #8019 from JosiasAurel/mypytester-change-01
...
Migrate from testdir to pytester
2020-11-13 10:36:03 +02:00
Josias Aurel
fa148eadfe
Update testing/test_faulthandler.py
...
Co-authored-by: Sanket Duthade <duthades@gmail.com>
2020-11-11 18:35:06 +01:00
Josias Aurel
06a597db14
Add type annotations
2020-11-11 05:02:32 +01:00
Josias Aurel
1ed8159c7d
Update testing/test_faulthandler.py
...
Co-authored-by: Sanket Duthade <duthades@gmail.com>
2020-11-11 04:45:57 +01:00
Josias Aurel
8320c07134
Update testing/test_faulthandler.py
...
Co-authored-by: Sanket Duthade <duthades@gmail.com>
2020-11-11 04:45:42 +01:00
Ran Benita
265cc2cfec
main: fix only one doctest collected on pytest --doctest-modules __init__.py
...
When --doctest-modules is used, an `__init__.py` file is not a `Package`
but a `DoctestModule`, but some collection code assumed that
`__init__.py` implies a `Package`. That code caused only a single test
to be collected in the scenario in the subject.
Tighten up this check to explicitly check for `Package`. There are
better solutions, but for another time.
Report & test by Nick Gates <nickgatzgates@gmail.com>.
2020-11-10 22:50:46 +02:00
Josias Aurel
043ed55056
Migrate from testdir to pytester
2020-11-09 18:07:34 +01:00
Ran Benita
e986d84466
Merge pull request #8006 from bluetech/export-MonkeyPatch
...
Export MonkeyPatch as pytest.MonkeyPatch
2020-11-09 11:45:38 +02:00