Ran Benita
5336ba28cc
Merge pull request #8218 from bluetech/reports2
...
Misc small code improvements
2021-01-04 22:47:32 +02:00
bengartner
8e00df4c4b
Add dot prefix if file makefile extension is invalid for pathlib ( #8222 )
2021-01-04 15:58:11 +02:00
Ran Benita
2ff88098a7
python: inline a simple method
...
I don't think it adds much value!
2021-01-01 23:23:08 +02:00
Ran Benita
8ee6d0a866
Always use getfixturemarker() to access _pytestfixturefunction
...
Keep knowledge of how the marker is stored encapsulated in one place.
2021-01-01 23:22:10 +02:00
Ran Benita
ade253c790
fixtures: type annotate FixtureRequest.keywords
2021-01-01 23:18:17 +02:00
Ran Benita
6c575ad8c8
fixtures: simplify FixtureRequest._get_fixturestack()
2021-01-01 23:15:57 +02:00
Ran Benita
73c4105230
reports: improve a type annotation
2021-01-01 15:22:05 +02:00
Ran Benita
7d306e9e86
reports: BaseReport.{passed,failed,skipped} more friendly to mypy
...
Not smart enough to understand the previous code.
2021-01-01 15:22:05 +02:00
Anton
48c9a96a03
Fix failing staticmethod tests if they are inherited ( #8205 )
...
* Fix failing staticmethod tests if they are inherited
* add comments, set default=None
2020-12-30 19:00:37 -08:00
Ran Benita
7585221d55
Merge pull request #8195 from christophebedard/add-missing-space-version-option-help-message
...
Add missing space in '--version' help message
2020-12-30 11:57:02 +02:00
pre-commit-ci[bot]
ee03e31831
[pre-commit.ci] pre-commit autoupdate ( #8201 )
...
* [pre-commit.ci] pre-commit autoupdate
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* manual fixes after configuration update
* [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: Anthony Sottile <asottile@umich.edu>
2020-12-30 11:56:09 +02:00
Christophe Bedard
bf9b59b3c8
Add missing space in '--version' help message
2020-12-28 10:50:06 -05:00
Ran Benita
96ea867fec
runner: export pytest.CallInfo for typing purposes
...
The type cannot be constructed directly, but is exported for use in type
annotations, since it is reachable through existing public API.
This also documents `from_call` as public, because at least
pytest-forked uses it, so we must treat it as public already anyway.
2020-12-26 21:38:37 +02:00
Ran Benita
bd76042344
python: export pytest.Metafunc for typing purposes
...
The type cannot be constructed directly, but is exported for use in type
annotations, since it is reachable through existing public API.
2020-12-26 21:05:02 +02:00
Ran Benita
6d3a66d947
nodes: avoid needing to expose NodeKeywords for typing
...
It adds no value over exporting just the ABC so do that to reduce the
API surface.
2020-12-26 19:54:07 +02:00
Ran Benita
d8d2df7e6f
Merge pull request #8174 from bluetech/py-to-pathlib-5
...
More py.path -> pathlib conversions
2020-12-26 15:01:07 +02:00
Ran Benita
ca4effc822
Convert most of the collection code from py.path to pathlib
2020-12-22 21:09:36 +02:00
Ran Benita
a218413008
pathlib: missing type annotation for fnmatch_ex
2020-12-22 21:08:25 +02:00
Ran Benita
92ba96b061
code: convert from py.path to pathlib
2020-12-22 21:08:25 +02:00
Ran Benita
6aa4d1c7ab
mark: export pytest.MarkGenerator for typing purposes
...
The type cannot be constructed directly, but is exported for use in type
annotations, since it is reachable through existing public API.
2020-12-20 15:59:20 +02:00
Ran Benita
69c302479e
mark: export pytest.MarkDecorator for typing purposes
...
The type cannot be constructed directly, but is exported for use in type
annotations, since it is reachable through existing public API.
2020-12-20 15:59:06 +02:00
Ran Benita
2ec372df8b
mark: export pytest.Mark for typing purposes
...
The type cannot be constructed directly, but is exported for use in type
annotations, since it is reachable through existing public API.
2020-12-20 15:58:49 +02:00
Ran Benita
042d12fae6
doctest: use Path instead of py.path where possible
2020-12-19 14:52:40 +02:00
Ran Benita
2c05a7babb
config: let main() accept any os.PathLike instead of just py.path.local
...
Really it ought to only take the List[str], but for backward
compatibility, at least get rid of the explicit py.path.local check.
2020-12-19 14:52:40 +02:00
Ran Benita
73586be08f
terminal: remove unused union arm in WarningReport.fslocation
2020-12-19 13:33:34 +02:00
antonblr
196b173c8a
address comments
2020-12-18 12:36:20 -08:00
antonblr
15156e94c4
tests: Migrate to pytester - final update
2020-12-18 11:02:38 -08:00
Ran Benita
d46ecbc18b
terminal: fix "(<Skipped instance>)" skip reason in test status line
2020-12-15 22:24:25 +02:00
Jakob van Santen
9ccbf5b899
python_api: handle array-like args in approx() ( #8137 )
2020-12-15 08:49:29 -03: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
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
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
Ran Benita
1a1bb61340
Merge pull request #8038 from matthewhughes934/note-tmpdir-lifetime
...
Docs: Note lifetime of temporary directories
2020-12-05 21:54:04 +02: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
Matthew Hughes
6a256606c6
Docs: Note lifetime of temporary directories
...
Explanation: The default handling of these lifetimes is done in
`tmpdir.TempPathFactory.getbasetemp`, which passes `keep=3` to
`pathlib.make_numbered_dir_with_cleanup`.
GH Issue: #8036
2020-11-28 21:18:16 +00:00
Ran Benita
70823da7ed
Merge pull request #8064 from symonk/fix-typo-in-mock-timing
...
fix mock_timing fixture name (typo) in timing.py
2020-11-25 12:29:34 +02:00
Jürgen Gmach
d27806295a
fix typo ( #8069 )
2020-11-24 22:27:34 +01:00
Simon K
b310872300
fix mock_timing fixture name (typo) in timing.py
2020-11-23 20:45:12 +00: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
148e3c582a
pytester: always close stdin pipe in pytester.run()
...
If the user passed stdin=PIPE for some reason, they have no way to close
it themselves since it is not exposed.
2020-11-20 17:55:30 +02:00