Daniel Hahler
c51173d426
Merge master into features
2020-01-25 14:18:02 +01:00
Ran Benita
a76bc64c54
Merge pull request #6547 from bluetech/session-initialparts
...
Refactor Session._initialparts to have a more explicit type
2020-01-25 14:30:26 +02:00
Ran Benita
dd5c2b22bd
Refactor Session._initialparts to have a more explicit type
...
Previously, _initialparts was a list whose first item was a
`py.path.local` and the rest were `str`s. This is not something that
mypy is capable of modeling. The type `List[Union[str, py.path.local]]`
is too broad and would require asserts for every access.
Instead, make each item a `Tuple[py.path.local, List[str]]`. This way
the structure is clear and the types are accurate.
To make sure any users who might have been accessing this (private)
field will not break silently, change the name to _initial_parts.
2020-01-25 13:57:49 +02:00
Daniel Hahler
6f2943c7b3
Merge pull request #6558 from gavento/patch-1
...
Make EncodedFile.write() return the return value from inner write()
2020-01-25 11:04:12 +01:00
Tomáš Gavenčiak
5e15c86cc6
Fix EncodedFile.write return value
...
Make EncodedFile, used for captured output streams, method .write return
the number of characters written. Add test for captured stderr write.
Fixes #6557 .
Co-Authored-By: Bruno Oliveira <nicoddemus@gmail.com>
2020-01-25 10:36:23 +01:00
Daniel Hahler
09bdbffbde
Merge master into features
...
Conflicts:
src/_pytest/_code/code.py
src/_pytest/main.py
2020-01-24 23:44:50 +01:00
Daniel Hahler
09ab5fd7e9
Merge pull request #6529 from blueyed/fix-test_repr_traceback_with_invalid_cwd
...
tests: fix test_repr_traceback_with_invalid_cwd
2020-01-24 23:41:31 +01:00
Daniel Hahler
192d3adda3
tests: add test_fixture_arg_ordering
...
This is a regression test for part of
https://github.com/pytest-dev/pytest/issues/6492 , testing one of the
fixes in https://github.com/pytest-dev/pytest/pull/6551 .
2020-01-24 17:48:08 -03:00
Daniel Hahler
79ae86cc3f
tests: fix test_repr_traceback_with_invalid_cwd
...
This never worked as expected (since a912d3745
), and only py38-windows
triggered the mocked `os.getcwd` unintentionally, via `inspect`.
2020-01-24 12:52:12 +01:00
Daniel Hahler
03bc8aba4e
config: typing for create_terminal_writer, re-export TerminalWriter
...
This also imports `TerminalWriter` explicitly via `_pytest._io`,
allowing for easier extending / replacing it.
2020-01-23 14:09:37 +01:00
Daniel Hahler
6b13379f37
Merge pull request #6521 from blueyed/harden-nose-raises
...
tests: improve test for `nose.raises`
2020-01-23 13:42:14 +01:00
Daniel Hahler
e7444bbd5e
tests: remove unnecessary `-rw` option
...
Warnings are enabled by default, which is tested by `test_getreportopt`.
2020-01-23 11:37:19 +01:00
Daniel Hahler
252eae5bc8
tests: fix/harden test_record_property
...
`-rv` is not a recognized reportchar. Probably `-v` was meant, but is
not necessary to check that there are no warnings.
Followup to 2018cf12b
(https://github.com/pytest-dev/pytest/pull/3360 ).
2020-01-23 10:49:59 +01:00
Daniel Hahler
1350c601dc
Node.location: handle str with _node_location_to_relpath
2020-01-23 10:45:31 +01:00
Daniel Hahler
8fa57c8384
tests: improve test for `nose.raises`
...
This should probably get transferred into a `pytest.fail` really, but
tests/documents the current behavior.
2020-01-23 10:45:26 +01:00
Daniel Hahler
aca1723d45
Merge master into features
2020-01-22 19:18:13 +01:00
Daniel Hahler
85df6bbe26
Merge pull request #6536 from blueyed/fix-test_cwd_snapshot
...
tests: fix test_cwd_snapshot
2020-01-22 16:46:04 +01:00
Daniel Hahler
d878d9d4d5
tests: use NotImplementedError with uncovered code
2020-01-22 15:38:12 +01:00
Bruno Oliveira
93b74d28d2
Merge remote-tracking branch 'upstream/master' into mm
...
Conflicts:
* src/_pytest/_code/code.py
* src/_pytest/main.py
* testing/python/metafunc.py
* testing/test_parseopt.py
* testing/test_pytester.py
2020-01-22 11:03:45 -03:00
Daniel Hahler
b8787b8732
tests: fix test_cwd_snapshot
...
Without restoring the cwd, successive tests might fail to parse the
config (via `_pytest.config._prepareconfig()`, for when `--lsof` is
used).
And it is good practice to restore the cwd in any case anyway.
2020-01-22 14:34:11 +01:00
Daniel Hahler
8f5fd537d8
--cache-clear: add test for keeping non-supporting files
...
Ref: https://github.com/pytest-dev/pytest/pull/6296
2020-01-21 22:16:56 +01:00
Ran Benita
fb99b5c66e
Revert "Fix type errors after adding types to the `py` dependency"
...
This reverts commit 930a158a6a
.
Regression test from Bruno Oliveira.
2020-01-20 23:44:56 +02:00
Bruno Oliveira
cdaa9c06e1
Revert "fixtures register finalizers with all fixtures before t… ( #6496 )
...
Revert "fixtures register finalizers with all fixtures before them in the stack"
2020-01-20 13:49:00 -03:00
Ran Benita
3392be37e1
Fix check_untyped_defs in test_runner
2020-01-19 20:01:07 +02:00
Ran Benita
3d2680b31b
Fix type of pytest.warns, and fix check_untyped_defs in test_recwarn
...
The expected_warning is optional.
2020-01-19 19:39:14 +02:00
Ran Benita
0b603156b9
Fix check_untyped_defs errors in test_pytester
2020-01-19 19:39:14 +02:00
Ran Benita
0c247be769
Add a few missing type annotations in _pytest._code
...
These are more "dirty" than the previous batch (that's why they were
left out). The trouble is that `compile` can return either a code object
or an AST depending on a flag, so we need to add an overload to make the
common case Union free. But it's still worthwhile.
2020-01-19 19:39:14 +02:00
Ran Benita
930a158a6a
Fix type errors after adding types to the `py` dependency
2020-01-19 14:48:24 +02:00
Daniel Hahler
32b62f770f
Merge pull request #6509 from blueyed/typing-minor
...
typing: minor improvements
2020-01-19 11:33:41 +01:00
Daniel Hahler
5c445b05e7
typing: py.io.TerminalWriter for tw arguments
2020-01-19 11:21:16 +01:00
Daniel Hahler
61f985f3c7
tests: test_excinfo: remove unused pytest_version_info
...
This might fail unnecessarily with a (wrong) determined version of e.g.
"4.7.dev307+ge98176cf5" (no patch version).
Ref: https://github.com/pytest-dev/pytest/pull/6506
2020-01-19 08:11:13 +01:00
Daniel Hahler
38fc208205
tests: terminal: harden/improve test_color_yes
2020-01-18 15:49:59 +01:00
Daniel Hahler
7a626921c0
[features] tests: fix test_crash_on_closing_tmpfile_py27
...
(cherry picked from commit 4f0eec2022
)
2020-01-18 14:52:18 +01:00
Daniel Hahler
d4d04e7f25
test_terminal: improve color handling
2020-01-18 13:16:27 +01:00
Daniel Hahler
4f0eec2022
tests: fix test_crash_on_closing_tmpfile_py27
2020-01-18 13:15:40 +01:00
Bruno Oliveira
cc7f294cfe
Revert "fixtures register finalizers with all fixtures before them in the stack"
...
This reverts commit 99180939fe
.
2020-01-17 12:55:57 -03:00
Daniel Hahler
2cce026766
Merge pull request #6476 from blueyed/fix-test_config
...
Fix test_config: wrong assertions, lint, unused fixtures
2020-01-17 10:31:41 +01:00
Daniel Hahler
e16cb2fdd0
Merge pull request #6444 from blueyed/fix-test_xfail_handling
...
tests: test_xfail_handling: use sys.dont_write_bytecode
2020-01-17 10:28:23 +01:00
Daniel Hahler
1667cf3350
Merge pull request #6384 from pv/showlocals-short
...
Make --showlocals work together with --tb=short
Fixes https://github.com/pytest-dev/pytest/issues/494
Ref: https://github.com/pytest-dev/pytest/issues/1715
2020-01-16 22:04:14 +01:00
Daniel Hahler
5049e25a6a
tests: cleanup unused fixtures
2020-01-16 21:12:48 +01:00
Bruno Oliveira
7a0d1b387d
Use a dummy RemoteTraceback for test in Python 3.5 Windows
...
Somehow in Python 3.5 on Windows this test fails with:
File "c:\hostedtoolcache\windows\python\3.5.4\x64\Lib\multiprocessing\connection.py", line 302, in _recv_bytes
overlapped=True)
OSError: [WinError 6] The handle is invalid
This only happens in this platform and Python version, decided to use
a dummy traceback as originally done in #6412 .
(cherry picked from commit b9c136b809
)
2020-01-16 20:03:16 +01:00
Daniel Hahler
83813bf515
Merge master into features
...
Conflicts:
.github/workflows/main.yml
2020-01-16 19:45:52 +01:00
Daniel Hahler
118cb3d3be
Fix test_config: wrong assertions, lint, unused fixtures
2020-01-16 19:27:46 +01:00
Jakub Mitoraj
ab6406b42e
Update junit_logging with no,log,system-out,system-err,out-err,all
2020-01-16 08:14:46 +01:00
Chris NeJame
99180939fe
fixtures register finalizers with all fixtures before them in the stack
2020-01-15 11:00:42 -05:00
Daniel Hahler
6f7a95c32e
tests: cover safe_getattr
2020-01-15 11:20:00 +01:00
Daniel Hahler
f5844449a8
Merge pull request #6442 from blueyed/rP
...
terminal: summary_passes: handle teardown sections
2020-01-15 03:02:09 +01:00
Bruno Oliveira
b9c136b809
Use a dummy RemoteTraceback for test in Python 3.5 Windows
...
Somehow in Python 3.5 on Windows this test fails with:
File "c:\hostedtoolcache\windows\python\3.5.4\x64\Lib\multiprocessing\connection.py", line 302, in _recv_bytes
overlapped=True)
OSError: [WinError 6] The handle is invalid
This only happens in this platform and Python version, decided to use
a dummy traceback as originally done in #6412 .
2020-01-14 18:31:21 -03:00
Pauli Virtanen
fd1691a2b3
Make --showlocals work together with --tb=short
...
Enable showing local variables when asked to do so in the short
traceback mode.
Fixes #494
2020-01-14 21:30:58 +02:00
Bruno Oliveira
e9d9f71374
Merge remote-tracking branch 'upstream/master' into mm
2020-01-14 09:17:52 -03:00