Ran Benita
c7a83a0f31
Remove a PyPy version check for an unsupported version
...
pytest doesn't support these PyPy versions anymore, so no need to have
checks for them.
2019-11-16 17:22:07 +02:00
Anthony Sottile
cc78444c30
Merge remote-tracking branch 'origin/master' into mm
2019-11-15 15:26:57 -08:00
Daniel Hahler
c49c61fdaf
Import Path from _pytest.pathlib for py35 ( #6193 )
2019-11-15 23:17:43 +01:00
Daniel Hahler
1abb08d52f
tests: use sys.dont_write_bytecode
...
Setting PYTHONDONTWRITEBYTECODE in the environment does not change it
for the current process.
2019-11-15 23:13:08 +01:00
Daniel Hahler
5979837c60
Import Path from _pytest.pathlib for py35
...
This is important for `isinstance` checks etc.
2019-11-15 22:19:53 +01:00
Anthony Sottile
4e0f99260d
Add regression tests for __init__.py breakage
2019-11-15 13:19:31 -08:00
Anthony Sottile
176c7771fb
Revert "fix bug with nonskipped first test in package ( #5831 )"
...
This reverts commit 85288b5321
, reversing
changes made to 5f9db8a017
.
2019-11-15 08:29:52 -08:00
Bruno Oliveira
d2ea9e2db5
Remove report_log in favor of pytest-reportlog
...
Fix #6180
2019-11-14 19:47:26 -03:00
Bruno Oliveira
6f2c0fd2e8
Show a better message when 'request' is used in parametrize
...
Fix #6183
2019-11-13 19:57:10 -03:00
Bruno Oliveira
2a67637acc
Issue a warning to prepare change of 'junit_family' default value
...
Fix #6179
2019-11-13 19:55:13 -03:00
Daniel Hahler
f91bf48a40
Merge pull request #6176 from blueyed/assertoutcome
...
pytester: Hookrecorder: improve assertoutcome
2019-11-13 19:27:18 +01:00
Daniel Hahler
a6e10cc2e3
Merge pull request #6181 from blueyed/maxfail-terminal-upstream
...
terminal: report ``session.shouldfail`` reason (``-x``)
2019-11-13 19:27:01 +01:00
Daniel Hahler
b06f33f474
terminal: report ``session.shouldfail`` reason (``-x``)
...
Via https://github.com/blueyed/pytest/pull/108 .
2019-11-13 16:18:41 +01:00
Daniel Hahler
6ddf7c3d42
pytester: Hookrecorder: improve assertoutcome
...
Before:
def assertoutcome(self, passed: int = 0, skipped: int = 0, failed: int = 0) -> None:
realpassed, realskipped, realfailed = self.listoutcomes()
assert passed == len(realpassed)
> assert skipped == len(realskipped)
E assert 1 == 0
E + where 0 = len([])
After:
> reprec = testdir.inline_run(testpath, "-s")
E AssertionError: ([], [], [<TestReport 'nodeid' when='call' outcome='failed'>])
E assert {'failed': 1, 'passed': 0, 'skipped': 0} == {'failed': 0, 'passed': 0, 'skipped': 1}
2019-11-13 13:48:20 +01:00
Daniel Hahler
fc1c015c6b
tests: remove test_nested_marks (xfail)
...
It currently fails with a TypeError, and was not updated since 2013 -
therefore it can be assumed that it is not important to support it.
```
____________________ ERROR collecting test_nested_marks.py _____________________
…/Vcs/pluggy/src/pluggy/hooks.py:286: in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
…/Vcs/pluggy/src/pluggy/manager.py:93: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
…/Vcs/pluggy/src/pluggy/manager.py:337: in traced_hookexec
return outcome.get_result()
…/Vcs/pluggy/src/pluggy/manager.py:335: in <lambda>
outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))
…/Vcs/pluggy/src/pluggy/manager.py:87: in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
…/Vcs/pytest/src/_pytest/python.py:235: in pytest_pycollect_makeitem
res = list(collector._genfunctions(name, obj))
…/Vcs/pytest/src/_pytest/python.py:404: in _genfunctions
self.ihook.pytest_generate_tests.call_extra(methods, dict(metafunc=metafunc))
…/Vcs/pluggy/src/pluggy/hooks.py:324: in call_extra
return self(**kwargs)
…/Vcs/pluggy/src/pluggy/hooks.py:286: in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
…/Vcs/pluggy/src/pluggy/manager.py:93: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
…/Vcs/pluggy/src/pluggy/manager.py:337: in traced_hookexec
return outcome.get_result()
…/Vcs/pluggy/src/pluggy/manager.py:335: in <lambda>
outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))
…/Vcs/pluggy/src/pluggy/manager.py:87: in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
…/Vcs/pytest/src/_pytest/python.py:130: in pytest_generate_tests
metafunc.parametrize(*marker.args, **marker.kwargs)
…/Vcs/pytest/src/_pytest/python.py:965: in parametrize
function_definition=self.definition,
…/Vcs/pytest/src/_pytest/mark/structures.py:111: in _for_parametrize
if len(param.values) != len(argnames):
E TypeError: object of type 'MarkDecorator' has no len()
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
```
2019-11-12 14:44:03 +01:00
Ran Benita
b352e34938
Merge pull request #6149 from bluetech/cached-property
...
Add a @cached_property implementation
2019-11-10 22:11:04 +02:00
Daniel Hahler
abcedd6095
_compare_eq_iterable: use AlwaysDispatchingPrettyPrinter ( #6151 )
2019-11-10 14:08:25 +01:00
Ran Benita
42a46ea786
Add a @cached_property implementation
...
This is a useful utility to abstract the caching property idiom.
It is in compat.py since eventually it will be replaced by
functools.cached_property.
Fixes #6131 .
2019-11-10 10:21:55 +02:00
Daniel Hahler
04f27d4eb4
unittest: do not use TestCase.debug() with `--pdb`
...
Fixes https://github.com/pytest-dev/pytest/issues/5991
Fixes https://github.com/pytest-dev/pytest/issues/3823
Ref: https://github.com/pytest-dev/pytest-django/issues/772
Ref: https://github.com/pytest-dev/pytest/pull/1890
Ref: https://github.com/pytest-dev/pytest-django/pull/782
- inject wrapped testMethod
- adjust test_trial_error
- add test for `--trace` with unittests
2019-11-10 00:21:51 +01:00
Bruno Oliveira
245e1f10e5
Merge pull request #6152 from grlee77/module_name_in_id
...
use __name__ attribute in the parametrize id for modules as well
2019-11-08 14:16:34 -03:00
Ran Benita
84b2c81db4
Drop the "alias" helper used in MarkDecorator
...
It is a little too obscure IMO, but the reason I want to drop it is that
type checking has no hope of understanding such dynamic constructs.
The warning argument wasn't used.
2019-11-08 11:22:46 +02:00
Gregory Lee
db82432ec8
add minimal test case
2019-11-08 01:39:29 -05:00
Daniel Hahler
cc503c1821
_compare_eq_iterable: use AlwaysDispatchingPrettyPrinter
...
This fixes/removes the previous hack of re-trying with minimum width,
which fails short when it splits strings.
This inherits from `pprint.PrettyPrinter` to override `_format` in a
minimal way to always dispatch, regardless of the given width.
Code ref: 5c0c325453/Lib/pprint.py (L170-L178)
2019-11-08 04:07:09 +01:00
Bruno Oliveira
6ad95716da
add --co option to collect-only ( #6116 )
...
add --co option to collect-only
2019-11-07 19:03:32 -03:00
Daniel Hahler
09709bba06
Use atomicrewrites only on Windows ( #6148 )
2019-11-07 22:13:26 +01:00
Bruno Oliveira
7ed33996f1
on_rm_rf_error: ignore os.open (no warning) ( #6074 )
...
on_rm_rf_error: ignore os.open (no warning)
2019-11-07 18:06:05 -03:00
NNRepos
4946cc8282
Add --co option to collect-only
...
Fix #5845
2019-11-07 17:50:27 -03:00
Daniel Hahler
45c4a8fb3d
Use atomicrewrites only on Windows
...
Fixes https://github.com/pytest-dev/pytest/issues/6147
2019-11-07 20:57:45 +01:00
Daniel Hahler
19b2f4bb8a
tests: use ids ( #6145 )
2019-11-07 14:43:46 +01:00
Daniel Hahler
f11237b066
_perform_collect: remove comment about untested code ( #6144 )
2019-11-07 13:18:08 +01:00
Daniel Hahler
14eaa05b60
Merge pull request #6143 from blueyed/test_source
...
test_source: do not instantiate Source objects during collection
2019-11-07 13:16:34 +01:00
Daniel Hahler
2e5cf1cc78
Fix order of format args with warning
2019-11-07 12:50:04 +01:00
Daniel Hahler
8aa0809fbc
on_rm_rf_error: ignore os.open (no warning)
...
Ref: https://github.com/pytest-dev/pytest/pull/6044/files#r339321752
2019-11-07 12:50:04 +01:00
Daniel Hahler
ab101658f0
saferepr: handle BaseExceptions ( #6047 )
2019-11-07 12:33:22 +01:00
Daniel Hahler
b268463243
Merge master into features ( #6111 )
2019-11-07 12:31:33 +01:00
Daniel Hahler
dd852ded70
_perform_collect: remove comment about untested code
...
Harden one test where it is tested.
All tests testing this:
testing/acceptance_test.py:184(TestGeneralUsage::test_not_collectable_arguments)
testing/acceptance_test.py:373(TestGeneralUsage::test_direct_addressing_notfound)
testing/acceptance_test.py:403(TestGeneralUsage::test_issue134_report_error_when_collecting_member[test_fun.py::test_a])
testing/acceptance_test.py:420(TestGeneralUsage::test_report_all_failed_collections_initargs)
testing/test_config.py:1309(test_config_blocked_default_plugins[python])
(via https://github.com/blueyed/pytest/pull/88 )
2019-11-07 12:29:36 +01:00
Daniel Hahler
dd6cf7c172
test_exc_chain_repr_without_traceback: use ids
2019-11-07 12:25:46 +01:00
Daniel Hahler
5c00226847
test_iterable_full_diff: use test ids
2019-11-07 12:24:01 +01:00
Daniel Hahler
e8a3d1adf2
Fix test_trace_with_parametrize_handles_shared_fixtureinfo for colors
2019-11-07 11:48:51 +01:00
Daniel Hahler
cb21a8db1d
test_source: do not instantiate Source objects during collection
2019-11-07 11:44:26 +01:00
Daniel Hahler
fee7c7b032
py38: do not call None() directly
...
Works around:
_____ ERROR collecting testing/io/test_saferepr.py _____
src/_pytest/python.py:502: in _importtestmodule
mod = self.fspath.pyimport(ensuresyspath=importmode)
.venv38/lib/python3.8/site-packages/py/_path/local.py:701: in pyimport
__import__(modname)
<frozen importlib._bootstrap>:991: in _find_and_load
???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:671: in _load_unlocked
???
src/_pytest/assertion/rewrite.py:136: in exec_module
source_stat, co = _rewrite_test(fn, self.config)
src/_pytest/assertion/rewrite.py:288: in _rewrite_test
co = compile(tree, fn, "exec", dont_inherit=True)
E File "…/Vcs/pytest/testing/io/test_saferepr.py", line 45
E None()
E ^
E SyntaxError: 'NoneType' object is not callable; perhaps you missed a comma?
2019-11-06 22:08:10 +01:00
Daniel Hahler
eb7a4e32ad
saferepr: handle BaseExceptions
...
This causes INTERNALERRORs with pytest-django, which uses
`pytest.fail` (derived from `BaseException`) to prevent DB access, when
pytest then tries to e.g. display the `repr()` for a Django `QuerySet`
etc.
Ref: https://github.com/pytest-dev/pytest-django/pull/776
2019-11-06 22:08:10 +01:00
Daniel Hahler
5be3a9b5ce
tests: speed up test_faulthandler.test_timeout ( #6075 )
2019-11-06 22:07:28 +01:00
Daniel Hahler
fe429d4ce8
assert: fix _compare_eq_iterable: re-format both sides ( #6137 )
2019-11-06 22:06:39 +01:00
Bruno Oliveira
85288b5321
fix bug with nonskipped first test in package ( #5831 )
...
fix bug with nonskipped first test in package
2019-11-06 16:06:46 -03:00
Bruno Oliveira
74f4ec5986
Making it possible to access the pluginmanager in the pytest_ad… ( #6106 )
...
Making it possible to access the pluginmanager in the pytest_addoptio…
2019-11-06 15:18:59 -03:00
Daniel Hahler
8dcee39ce9
Merge pull request #6103 from blueyed/lsof_check
...
tests: lsof_check: include exc with skip message
2019-11-06 18:44:19 +01:00
Daniel Hahler
4e45472405
Merge master into features
...
Conflicts:
src/_pytest/debugging.py
2019-11-06 14:22:07 +01:00
Daniel Hahler
92b436c938
Merge pull request #6136 from blueyed/fix-rm_rf-tests
...
Fix rm_rf tests
2019-11-06 14:19:47 +01:00
Daniel Hahler
01769b141a
Merge pull request #6100 from blueyed/fix-skip-offset
...
terminal: fix line offset with skip reports
2019-11-06 13:29:40 +01:00
Daniel Hahler
0485b07ff0
Merge pull request #6071 from blueyed/tests-doctest-mock
...
Tests: approx: mock doctest runner's pdb usage
2019-11-06 13:27:50 +01:00
Daniel Hahler
eb4b3ce1c8
Merge pull request #6084 from blueyed/merge-rm
...
tests: merge/remove test_dontreadfrominput_buffer_python3
2019-11-06 13:24:47 +01:00
Daniel Hahler
ce3d431002
assert: fix _compare_eq_iterable: re-format both sides
...
Follow-up to 946434c61
(#5924 ).
Before this patch the test would look like this:
{'env': {'sub...s wrapped'}}}} == {'env': {'sub...}}}, 'new': 1}
Omitting 1 identical items, use -vv to show
Right contains 1 more item:
{'new': 1}
Full diff:
{
'env': {'sub': {'long_a': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
- 'sub1': {'long_a': 'substring '
+ 'sub1': {'long_a': 'substring that gets wrapped'}}},
? +++++++++++++++++ ++++
+ 'new': 1,
- 'that '
- 'gets '
- 'wrapped'}}},
}
2019-11-06 11:23:15 +01:00
Daniel Hahler
e7320c6b54
Merge pull request #5926 from AtakamaLLC/optional-multiline
...
Add log-auto-indent option to control multiline formatting
2019-11-06 00:35:24 +01:00
Daniel Hahler
00f67494e5
Merge pull request #6107 from MarcoGorelli/color-percentage-indicator
...
Color percentage indicator
2019-11-06 00:28:45 +01:00
Daniel Hahler
d8096925fa
Fix for Python 3.5 not handling LocalPath
2019-11-06 00:22:46 +01:00
Daniel Hahler
9309ae299a
Use try/finally to ensure chmod is run, filter warning
2019-11-05 22:28:32 +01:00
Tibor Arpas
262ed567d0
tests: clean up chmod-related tests to fix rm_rf warnings
...
Fixed https://github.com/pytest-dev/pytest/issues/5974#issuecomment-549822509 .
2019-11-05 22:10:27 +01:00
Daniel Hahler
0794289689
Merge pull request #6129 from blueyed/typing
...
Typing around Node.location, reportinfo, repr_excinfo etc
2019-11-05 18:29:29 +01:00
Daniel Hahler
cab29dc861
Merge pull request #6124 from blueyed/test_group_warnings_by_message-ignore-own-warning
...
test_group_warnings_by_message: ignore own PytestExperimentalApiWarning
2019-11-05 16:24:10 +01:00
Daniel Hahler
741f0fedd1
typing around Node.location, reportinfo, repr_excinfo etc
2019-11-05 16:22:58 +01:00
MarcoGorelli
0d79061432
Color percentage indicator according to color of final line
...
indicate current outcome/status with color of percentage indicator
Fix type annotation, refactor _write_progress_information_filling_space
Keep code in _get_main_color as similar as possible to how it was before
Write test
Make black-compliant
Fix error in newly introduced test_collecterror
Make tests more readable by using constants and f-strings
Remove accidentally added monkeypatch
Make Python 3.5-compatible, add changelog entry
Add newline at the end of changelog file
2019-11-04 19:57:07 +00:00
Daniel Hahler
9f800b2a77
test_terminal: reduce number of tests (single --fulltrace param)
...
Remove the `--fulltrace` arg from the `Option` fixture used in several
tests, but not checked for. Only use it with `test_keyboard_interrupt`.
(removes 8 tests, coverage not affected)
2019-11-03 21:23:18 +01:00
Daniel Hahler
68dbc24dcb
test_group_warnings_by_message: ignore own PytestExperimentalApiWarning
2019-11-03 21:14:24 +01:00
MarcoGorelli
9303de877a
Fix error in newly introduced test_collecterror
...
Via https://github.com/pytest-dev/pytest/pull/6107 .
(cherry picked from commit 1b9fbbfa195aa20c48574265935dc5e66b96ec16)
2019-11-03 18:16:46 +01:00
Daniel Hahler
3fb969897a
Merge pull request #6059 from blueyed/collect-error-short-summary
...
terminal: report collection errors as "ERROR" in short summary
2019-11-02 15:34:12 +01:00
Daniel Hahler
6df4d07a57
Merge pull request #6067 from blueyed/harden-test
...
tests: harden test_disabled_capture_fixture
2019-11-02 15:33:55 +01:00
Florian Bruhin
35800a2f73
Merge pull request #6112 from gaucheph/fix-small-typo
...
typos
2019-11-01 11:18:06 +01:00
Patrick Harmon
abc890079f
typos
2019-10-31 23:19:35 -05:00
David Szotten
285524c6cd
Fix --trace for parametrized tests
...
Without this, the second time it tries to stop in a parametrized
function it raises instead:
`ValueError: --trace can't be used with a fixture named func!`
Implementation idea, test (and changelog tweaks) thanks to blueyed
Co-Authored-By: Ronny Pfannschmidt <opensource@ronnypfannschmidt.de>
Co-Authored-By: Daniel Hahler <git@thequod.de>
2019-10-31 21:41:33 +00:00
Joshua Storck
7a96d94fd4
Making it possible to access the pluginmanager in the pytest_addoption hook
2019-10-30 14:18:13 -04:00
Bruno Oliveira
b99661b9d7
Introduce --report-log option
...
Fix #4488
2019-10-30 09:43:33 -03:00
Daniel Hahler
8c21416798
lsof_check: include exc with skip message
2019-10-29 15:25:15 +01:00
Daniel Hahler
6d2cabae57
terminal: fix line offset with skip reports
...
The original fix in https://github.com/pytest-dev/pytest/pull/2548 was
wrong, and was likely meant to fix the use with decorators instead,
which this does now (while reverting 869eed9898
).
2019-10-29 13:11:02 +01:00
Daniel Hahler
cdc53da19c
Merge pull request #5990 from MarcoGorelli/plurality-matching
...
Plurality matching
2019-10-28 17:03:15 +01:00
Daniel Hahler
e7898dedf4
Merge pull request #6093 from blueyed/fix-flaky
...
tests: fix testing/test_capture.py::test_typeerror_encodedfile_write
2019-10-28 16:17:46 +01:00
Daniel Hahler
60ceec6eb1
tests: fix testing/test_capture.py::test_typeerror_encodedfile_write
...
Failed for me due to different indent (?) - not reproducible:
> ???
E Failed: nomatch: 'E TypeError: write() argument must be str, not bytes'
…
E and: '> def mode(self):'
E and: 'E TypeError: write() argument must be str, not bytes'
…
E remains unmatched: 'E TypeError: write() argument must be str, not bytes'
2019-10-28 14:37:26 +01:00
Daniel Hahler
a4554e666a
tests: speed up test_faulthandler.test_timeout
2019-10-28 13:44:06 +01:00
Daniel Hahler
d6e324a5e6
tests: conftest: handle tests using runpytest_subprocess as "slowest"
2019-10-28 13:43:42 +01:00
Daniel Hahler
a5bd19e3b4
tests: lazily import doctest in approx tests
2019-10-28 12:55:16 +01:00
Daniel Hahler
32412532ef
tests: mock doctest.DocTestRunner to not use real pdb
...
It is not used there anyway, and might cause false positives.
2019-10-28 12:55:16 +01:00
Daniel Hahler
820b747e7a
tests: merge/remove test_dontreadfrominput_buffer_python3
2019-10-27 19:32:06 +01:00
MarcoGorelli
d863c30c74
Fix plurality mismatch for and in pytest terminal summary
2019-10-27 15:16:24 +00:00
Daniel Hahler
886a3ad609
pytester: typing
2019-10-27 12:32:14 +01:00
Daniel Hahler
81c3bc76bc
tests: harden test_disabled_capture_fixture
2019-10-27 03:02:24 +01:00
Daniel Hahler
7f1af84f47
Merge master into features
...
Conflicts:
src/_pytest/logging.py
2019-10-27 02:06:36 +01:00
Bruno Oliveira
cefe6bfec3
Replace a few outdated references to py.test with pytest ( #6063 )
...
Replace a few outdated references to py.test with pytest
2019-10-26 12:59:22 -03:00
Bruno Oliveira
6f20b4b014
Introduce compat.fspath
2019-10-26 10:37:44 -03:00
Ran Benita
0b8c35516f
Replace py.io.TextIO with io.StringIO
...
In Python3, py.io.TextIO is just an alias to io.StringIO. Remove the
indirection.
2019-10-26 16:33:57 +03:00
Ran Benita
96de232791
Replace a few outdated references to py.test with pytest
2019-10-26 16:28:17 +03:00
Bruno Oliveira
f93f284356
Support sys.pycache_prefix on py38
...
Fix #4730
2019-10-26 10:17:21 -03:00
Kale Kundert
b9df9a4761
Merge pull request #6058 from AnjoMan/6057-tolerance-on-complex-approx
...
6057 tolerance on complex approx
2019-10-25 15:31:47 -04:00
Michael Krebs
1f5b454355
Add log-auto-indent option to control multiline formatting
2019-10-25 11:31:33 -04:00
Daniel Hahler
82753bec50
terminal: report collection errors as "ERROR" in short summary
2019-10-25 07:03:32 +02:00
AnjoMan
34a02121ad
Drop python 2 unicode tests for approx repr
2019-10-24 23:44:13 -04:00
AnjoMan
ed9fda84d3
Add tolerance to complex numbers
2019-10-24 23:44:13 -04:00
Bruno Oliveira
fb0e8b99d1
Merge remote-tracking branch 'upstream/master' into mm
...
Conflicts:
- src/_pytest/cacheprovider.py
2019-10-24 21:13:43 -03:00
Bruno Oliveira
d1bc2601e4
pytester: align prefixes ( #6026 )
...
pytester: align prefixes
2019-10-24 18:50:29 -03:00
Daniel Hahler
8ef4287bf0
pytester: align prefixes
...
This is important for using another match_nickname, e.g. "re.match".
TODO:
- [ ] changelog
- [ ] test
2019-10-24 23:20:12 +02:00
Daniel Hahler
45fc0d9cd8
Merge pull request #6040 from blueyed/test_meta-slow
...
tests: mark test_meta as slow
2019-10-24 22:53:04 +02:00
Bruno Oliveira
432e5550e5
assertrepr_compare: use safeformat with -vv ( #5936 )
...
assertrepr_compare: use safeformat with -vv
2019-10-23 19:51:40 -03:00
Ran Benita
7a2d2d8f07
Merge pull request #5847 from bluetech/type-annotations-4
...
2/X Fix check_untyped_defs = True mypy errors
2019-10-23 22:52:23 +03:00
Daniel Hahler
6242777818
Merge pull request #6041 from blueyed/pytester-splitlines
...
pytester: runpytest_inprocess: use splitlines()
2019-10-23 21:42:21 +02:00
Bruno Oliveira
20ee883b5f
Show the mnemonic of pytest.ExitCode in RunResult's repr ( #6043 )
...
Show the mnemonic of pytest.ExitCode in RunResult's repr
2019-10-23 10:46:58 -03:00
Bruno Oliveira
7beb520555
Show the mnemonic of pytest.ExitCode in RunResult's repr
...
Fix #4901
2019-10-23 09:16:02 -03:00
Bruno Oliveira
ba4b8c869c
Review rm_rf handling of FileNotFoundErrors
2019-10-23 08:30:52 -03:00
Ran Benita
1787bffda0
Fix check_untyped_defs errors in capture
2019-10-23 14:20:15 +03:00
Ran Benita
1984c10427
Fix check_untyped_defs errors in doctest
...
In order to make the LiteralOutputChecker lazy initialization more
amenable to type checking, I changed it to match the scheme already used
in this file to lazy-initialize PytestDoctestRunner.
2019-10-23 14:20:14 +03:00
Daniel Hahler
db9e248b2e
Merge pull request #6039 from blueyed/test_doctest_id
...
doctest: unset RUNNER_CLASS in pytest_unconfigure
2019-10-23 11:38:59 +02:00
Daniel Hahler
2f589a9769
pytester: runpytest_inprocess: use splitlines()
...
This avoids having a trailing empty lines always.
2019-10-23 04:34:29 +02:00
Daniel Hahler
b079dc2dbe
Fix test_doctest_set_trace_quit on features
2019-10-23 04:13:37 +02:00
Daniel Hahler
4af89bba9d
Merge pull request #5061 from blueyed/summary_stats-multi-color
...
Multiple colors with terminal summary_stats
2019-10-23 03:21:39 +02:00
Daniel Hahler
5e7b2ae704
doctest: pytest_unconfigure: reset RUNNER_CLASS
...
This is important when used with ``pytester``'s ``runpytest_inprocess``.
Since 07f20ccab
`pytest testing/acceptance_test.py -k test_doctest_id`
would fail, since the second run would not consider the exception to be
an instance of `doctest.DocTestFailure` anymore, since the module was
re-imported, and use another failure message then in the short test
summary info (and in the report itself):
> FAILED test_doctest_id.txt::test_doctest_id.txt - doctest.DocTestFailure: <Do...
while it should be:
> FAILED test_doctest_id.txt::test_doctest_id.txt
2019-10-23 03:09:41 +02:00
Daniel Hahler
82e9013e73
Merge pull request #6004 from blueyed/fix-nf
...
cache: NFPlugin: keep known nodeids
2019-10-23 01:04:48 +02:00
Bruno Oliveira
f4734213e5
Merge remote-tracking branch 'upstream/features' into blueyed/pdb-doctest-bdbquit
2019-10-22 19:43:35 -03:00
Daniel Hahler
0dd68ba0b6
tests: mark test_meta as slow
...
This moves it to the end of tests during collection. Takes ~7s for me.
2019-10-22 23:44:52 +02:00
Daniel Hahler
554dba391c
Multiple colors with terminal summary_stats
...
Ref: https://github.com/pytest-dev/pytest/issues/5060
2019-10-21 04:35:45 +02:00
Daniil Galiev
9275012ef7
fix bug with nonskipped first test in package
2019-10-21 00:11:24 +02:00
Daniel Hahler
803cc1f294
Merge master into features
2019-10-21 00:08:03 +02:00
Daniel Hahler
d91ff0af8a
assertrepr_compare: use safeformat with -vv
2019-10-20 20:51:03 +02:00
Daniel Hahler
0123b29ed7
tests: remove unnecessary test, clarify
...
Follow-up to https://github.com/pytest-dev/pytest/pull/6009 .
2019-10-20 20:40:13 +02:00
Bruno Oliveira
16efa1bfef
Merge pull request #6009 from yoavcaspi/fix_keyboardInterrupt_on_setup_show
...
setuponly: remove printing out/err from capman
2019-10-20 14:00:06 -03:00
Daniel Hahler
fbb7f663be
Merge pull request #6005 from blueyed/harden-trial
...
tests: harden/fix test_trial_error
2019-10-20 17:35:15 +02:00
Yoav Caspi
5624e366c1
add more indications to the result of the tests
2019-10-20 09:54:23 +03:00
Anthony Sottile
3a402811de
Ensure .pytest_cache file has a newline at the end
2019-10-19 14:42:06 -07:00
Bruno Oliveira
b5579d2cf2
Make InvocationParams.args a tuple ( #6008 )
...
Make InvocationParams.args a tuple
2019-10-19 17:36:42 -03:00
Bruno Oliveira
d12cdd3127
Make InvocationParams.args a tuple
...
This avoids mutating the original list to reflect on InvocationParams,
which is supposed to be an immutable snapshot of the state of pytest.main()
at the moment of invocation (see pytest-dev/pytest-xdist#478 ).
2019-10-19 16:42:58 -03:00
Yoav Caspi
e05b33ed16
setuponly: remove printing out/err from capman
2019-10-19 22:33:19 +03:00
Daniel Hahler
15f9568694
Improve/revisit CallInfo.__repr__
2019-10-19 19:07:11 +02:00
Daniel Hahler
5b88612e5b
tests: harden/fix test_trial_error
2019-10-19 09:03:26 +02:00
Daniel Hahler
3173a26388
cache: NFPlugin: keep known nodeids
...
Caveat: does not forget about old nodeids
Fixes https://github.com/pytest-dev/pytest/issues/5206
2019-10-19 04:53:01 +02:00
Daniel Hahler
0976e2f50d
Merge master into features
2019-10-18 17:51:42 +02:00
Daniel Hahler
7ef44913a1
tests: debugging: disable pdb++ within inner tests
...
Ref: https://github.com/pytest-dev/pytest/pull/5306#issuecomment-495690643
2019-10-18 17:08:39 +02:00
Daniel Hahler
90dfee5da5
tests: keep numpy being optional
...
Ref: https://github.com/pytest-dev/pytest/pull/5950#discussion_r335254774
2019-10-16 23:50:23 +02:00
Bruno Oliveira
914a9465ab
tests: move tests for setuponly/setupplan ( #5961 )
...
tests: move tests for setuponly/setupplan
2019-10-15 19:49:26 -03:00
Daniel Hahler
c2ae0e0dc6
tests: move tests for setuponly/setupplan
...
Forgotten in 032ce8baf
.
2019-10-15 00:41:05 +02:00
Daniel Hahler
361f0e6ba7
minor: test_failure_function: use vars
2019-10-14 22:45:25 +02:00
Victor Maryama
63e3d89647
Fixed linting.
2019-10-12 15:08:47 +02:00
Victor Maryama
1f639e2c22
Casting fixture parameter to list at the beginning of parameter parsing.
2019-10-12 14:33:43 +02:00
Daniel Hahler
fb90259460
test_assertion: improve mock_config
2019-10-11 04:19:07 +02:00
Daniel Hahler
2a2fe7d3db
Improve ExceptionInfo.__repr__
2019-10-09 19:27:46 +02:00
Daniel Hahler
21c038f304
Merge master into features
2019-10-08 18:57:15 +02:00
Daniel Hahler
946434c610
Improve full diff output for lists
...
Massage text input for difflib when comparing pformat output of
different line lengths.
Also do not strip ndiff output on the left, which currently already
removes indenting for lines with no differences.
Before:
E AssertionError: assert ['version', '...version_info'] == ['version', '...version', ...]
E Right contains 3 more items, first extra item: ' '
E Full diff:
E - ['version', 'version_info', 'sys.version', 'sys.version_info']
E + ['version',
E + 'version_info',
E + 'sys.version',
E + 'sys.version_info',
E + ' ',
E + 'sys.version',
E + 'sys.version_info']
After:
E AssertionError: assert ['version', '...version_info'] == ['version', '...version', ...]
E Right contains 3 more items, first extra item: ' '
E Full diff:
E [
E 'version',
E 'version_info',
E 'sys.version',
E 'sys.version_info',
E + ' ',
E + 'sys.version',
E + 'sys.version_info',
E ]
2019-10-08 15:27:51 +02:00
Anthony Sottile
3fada8c8ee
Merge pull request #5925 from asottile/fix_resource_warning_again_5088
...
Fix spurious ResourceWarning stderr in testsuite again
2019-10-07 16:26:38 -07:00
Anthony Sottile
19eb0590f1
Fix spurious ResourceWarning stderr in testsuite again
2019-10-06 19:11:33 -07:00
Bruno Oliveira
5186635387
Introduce no_fnmatch_line/no_re_match_line in pytester ( #5914 )
...
Introduce no_fnmatch_line/no_re_match_line in pytester
2019-10-06 20:27:20 -03:00
Anthony Sottile
eaa05531ed
Add test to ensure _pytest is warning-clean on import
2019-10-06 14:11:08 -07:00
Bruno Oliveira
47c2091ecd
Use new no-match functions to replace previous idiom
2019-10-06 18:05:24 -03:00
Bruno Oliveira
0c18e24433
Introduce no_fnmatch_line/no_re_match_line in pytester
...
The current idiom is to use:
assert re.match(pat, result.stdout.str())
Or
assert line in result.stdout.str()
But this does not really give good results when it fails.
Those new functions produce similar output to ther other match lines functions.
2019-10-06 18:05:24 -03:00
Daniel Hahler
07f20ccab6
Allow for "pdb" module to be rewritten
2019-10-06 23:02:24 +02:00
Anthony Sottile
c58b0fb4ac
Use ATTRS_EQ_FIELD for attrs 19.2 compat
2019-10-05 18:16:35 -07:00
Hynek Schlawack
a79acf279a
Fix warnings with attrs 19.2 and fix object assertions
...
attrs 19.2 deprecated cmp in favor of the dataclass-ish eq/order duo.
This causes deprecation warnings that in turn break some of the cool new deep
object comparisons. Since we at attrs expected this to be a problem, it shipped
with helpers to write backward and forward compatible code.
This PR uses that and avoids changed to minimal versions.
2019-10-01 20:47:59 +02:00
Bruno Oliveira
7bdfba3578
Fix --setup-only and --setup-show for custom pytest items
...
Fix #5884
2019-09-28 11:52:09 -03:00
Anthony Sottile
19c9e53604
Make sure to quote `sys.executable` as we're running a shell
2019-09-23 08:58:56 -07:00
Bruno Oliveira
c28b63135f
Merge master into features ( #5874 )
...
Merge master into features
2019-09-23 12:44:20 -03:00
Tomáš Chvátal
04c01fb606
test_argcomplete do not call python directly #5872
...
Use sys.executable to detect which python we should actually be testing.
2019-09-23 16:38:15 +02:00
Andrzej Klajnert
e2382e96ed
Minor cleanup in tests.
2019-09-19 11:13:22 +02:00
Bruno Oliveira
df46afc96d
Change fixture argument handling tests to unit-tests
2019-09-18 07:50:35 -03:00
Bruno Oliveira
6918d07560
Merge remote-tracking branch 'upstream/features' into aklajnert/1682-dynamic-scope
2019-09-18 07:44:18 -03:00
Daniel Hahler
450409d123
Merge master into features
...
Conflicts:
src/_pytest/reports.py
(via 7259c453d
, moved the type annotation; setting it to `None`
was removed in 3c82b1cb9
already)
2019-09-17 12:46:36 +02:00
Daniel Hahler
702acdba46
Merge pull request #5811 from blueyed/fulltrace-pytest-raises
...
Handle --fulltrace with pytest.raises
2019-09-14 02:09:36 +02:00
Daniel Hahler
f832ac3316
Handle --fulltrace with pytest.raises
...
This changes `_repr_failure_py` to use `tbfilter=False` always.
2019-09-14 01:41:43 +02:00
Bruno Oliveira
b48f51eb03
Use Path() objects to store conftest files
...
Using Path().resolve() is better than py.path.realpath because
it resolves to the correct path/drive in case-insensitive file systems (#5792 ):
>>> from py.path import local
>>> from pathlib import Path
>>>
>>> local('d:\\projects').realpath()
local('d:\\projects')
>>> Path('d:\\projects').resolve()
WindowsPath('D:/projects')
Fix #5819
2019-09-12 08:05:50 -03:00
Bruno Oliveira
cf5b544db3
Revert "Merge pull request #5792 from dynatrace-oss-contrib/bugfix/badcase"
...
This reverts commit 955e542210
, reversing
changes made to 0215bcd84e
.
Will attempt a simpler approach
2019-09-12 08:05:43 -03:00
Hugo
d049b35397
Fix for Python 4: replace unsafe PY3 with PY2
2019-09-05 18:06:47 +03:00
aklajnert
10bf6aac76
Implemented the dynamic scope feature.
2019-08-31 18:12:24 +02:00
Michael Goerz
f8dd6349c1
Fix "lexer" being used when uploading to bpaste.net
...
Closes #5806 .
2019-08-30 15:34:03 -04:00
Bruno Oliveira
bd57307a39
Merge pull request #5768 from robholt/fixture-class-instance
...
Fix self reference in function scoped fixtures
2019-08-30 12:31:16 -03:00
Bruno Oliveira
4e594552eb
Merge pull request #5798 from aklajnert/570-indirect-fixtures
...
Fix the scope behavior with indirect fixtures
2019-08-30 12:29:03 -03:00
Bruno Oliveira
955dc6d18a
Merge remote-tracking branch 'upstream/master' into robholt/fixture-class-instance
2019-08-30 11:21:33 -03:00
Bruno Oliveira
3ddbc7fb2a
Improve CHANGELOG and add some comments
...
Ref: #5768
2019-08-30 11:20:19 -03:00
Bruno Oliveira
35b3b1097f
Improve CHANGELOG and make test easier to understand for #570
2019-08-30 10:54:58 -03:00
Bruno Oliveira
01082fea12
Serialize/deserialize chained exceptions ( #5787 )
...
Serialize/deserialize chained exceptions
2019-08-30 07:29:48 -03:00
Bruno Oliveira
a511b98da9
Serialize/deserialize chained exceptions
...
Fix #5786
2019-08-29 20:23:44 -03:00
Andrzej Klajnert
487659d8b1
Fix the scope behavior with indirect fixtures.
2019-08-29 07:23:08 +02:00
Christian Neumüller
29bb0eda27
Move _uniquepath to pathlib as unique_path.
...
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2019-08-28 12:29:41 +02:00
Christian Neumüller
1aac64573f
black formatting.
2019-08-27 16:16:45 +02:00
Michael Goerz
d47b9d04d4
Gracefully handle HTTP errors from pastebin
...
We find that the --pastebin option to pytest sometimes fails with "HTTP
Error 400: Bad Request". We're still investigating the exact cause of
these errors, but in the meantime, a failure to upload to the pastebin
service should probably not crash pytest and cause a test failure in the
continuous-integration.
This patch catches exceptions like HTTPError that may be thrown while
trying to communicate with the pastebin service, and reports them as a
"bad response", without crashing with a backtrace or failing the entire
test suite.
2019-08-26 23:50:46 -04:00
Bruno Oliveira
c28e428249
Merge remote-tracking branch 'upstream/master' into mm
2019-08-26 20:00:30 -03:00
Christian Neumüller
505c3340bf
Fix pytest with mixed up filename casing.
2019-08-26 17:18:46 +02:00
Bruno Oliveira
7a69365486
Move TWMock class to a fixture
...
Using a relative import like before was not very nice
2019-08-26 11:32:57 -03:00
Bruno Oliveira
691c706fcc
Add test for #5782
2019-08-24 14:41:06 -03:00
Anthony Sottile
daff9066c0
Merge pull request #5752 from bluetech/typing-py350-fix
...
Fix TypeError when importing pytest on Python 3.5.0 and 3.5.1
2019-08-20 08:04:58 -07:00
Ran Benita
43eab917a1
Fix coverage
2019-08-20 15:41:32 +03:00
Ran Benita
a7c235732a
Pypy doesn't have sys.getrefcount(), so go back to gc
2019-08-20 11:47:22 +03:00
Ran Benita
cec2183aeb
Add workaround for test_raises_cyclic_reference in Python 3.5.{0,1}
2019-08-20 11:19:25 +03:00
Robert Holt
62381125e7
Fix self reference in function scoped fixtures
2019-08-19 15:57:39 -04:00
Daniel Hahler
e5f4c47cd5
test_assertion: minor cleanup
2019-08-17 21:38:52 +02:00
Daniel Hahler
05bfe73cf9
Fix wrong location of assertion error with coverage.py
...
Reverts using-constant part from 39ba99613
.
Fixes https://github.com/pytest-dev/pytest/issues/5754 .
2019-08-17 21:34:13 +02:00
Daniel Hahler
2a6a1ca07d
Inject width via pylib to argparse formatter
...
`argparse.HelpFormatter` looks at `$COLUMNS` only, falling back to a
default of 80.
`py.io.get_terminal_width()` is smarter there, and could even work
better with https://github.com/pytest-dev/py/pull/219 .
This ensures to use a consistent value for formatting the ini values etc.
2019-08-17 16:51:02 +02:00
Bruno Oliveira
8ccc0177c8
Release 5.1.0 ( #5748 )
...
Release 5.1.0
2019-08-15 22:35:59 -03:00
Daniel Hahler
6ead01aacd
testing/python/fixtures.py: use NotImplementedError pattern
2019-08-16 01:14:19 +02:00
Bruno Oliveira
d7f082519a
Merge remote-tracking branch 'upstream/master' into mm
...
Conflicts:
src/_pytest/outcomes.py
2019-08-15 10:03:52 -03:00
Bruno Oliveira
2d613a03b3
Async result warn ( #5742 )
...
Async result warn
2019-08-15 09:47:56 -03:00
Bruno Oliveira
28c6c5bb71
check that tests that are partial staticmethods are supported ( #5701 )
...
check that tests that are partial staticmethods are supported
2019-08-15 09:12:01 -03:00
Thomas Grainger
6b9d729ed3
also warn on awaitable or async iterable test results
2019-08-15 12:30:44 +01:00
Bruno Oliveira
0ba774a7c3
warn for async generator functions ( #5734 )
...
warn for async generator functions
2019-08-15 08:17:12 -03:00
Thomas Grainger
137255816e
Fix collection of staticmethods defined with functools.partial
...
Related to #5701
2019-08-15 08:04:05 -03:00
Thomas Grainger
2f1b192fe6
Issue a warning for async gen functions
...
Co-Authored-By: Bruno Oliveira <nicoddemus@gmail.com>
2019-08-15 07:54:10 -03:00
dmitry.dygalo
7183335e62
Capture warnings during ``pytest_configure``
...
Fix #5115
2019-08-15 07:50:27 -03:00
Daniel Hahler
cb481a354a
assertrepr_compare: prefer same maxsize
...
Previously it would say:
> assert '123456789012...901234567890A' == '1234567890123...901234567890B'"
This makes it look like the "3" might be different already.
This is clearer, and it is OK to have potentially one less char in the
right one:
> assert '123456789012...901234567890A' == '123456789012...901234567890B'"
2019-08-12 03:41:14 +02:00
Bruno Oliveira
300f78556f
Show session duration in human-readable format ( #5721 )
...
Show session duration in human-readable format
2019-08-10 23:05:34 -03:00
Daniel Hahler
0db9dade65
test_non_ascii_paste_text: mock call to urlopen
...
Likely to fix flaky coverage due to requests failing sometimes.
Ref: f7e81dab9a...83a1f4bd66
/changes
2019-08-10 23:30:49 +02:00
Bruno Oliveira
345df99db7
Show session duration in human-readable format
...
Fix #5707
2019-08-10 10:45:53 -03:00
Bruno Oliveira
2f065a555f
Merge remote-tracking branch 'upstream/master' into release-5.1.0
2019-08-09 12:36:19 -03:00
Bruno Oliveira
ba72b480b9
Remove xfail marker from test_runs_twice_xdist
...
Apperently it does not hang, let's see how it fares on CI
2019-08-09 10:55:06 -03:00
Bruno Oliveira
ba76080b59
Validate xunit2 files against the schema
...
Fix #5095
2019-08-09 10:55:06 -03:00
Thomas Grainger
ef0915e1db
fix grammar in test_collect_functools_partial docstr
2019-08-06 15:27:36 +01:00
Daniel Hahler
aa06e6c8f3
Merge master into features
2019-08-05 19:12:32 +02:00
Daniel Hahler
198fcd8a6f
Fix RuntimeError when trying to collect package with "__init__.py" only
...
Fixes https://github.com/pytest-dev/pytest/issues/4344 .
2019-08-05 17:52:21 +02:00
Anthony Sottile
82763a293a
Merge pull request #5684 from nicoddemus/errno-nomore
...
Use OSError subclasses instead of handling errno
2019-08-04 14:50:12 -07:00
Samuel Searles-Bryant
1ce45a6f67
Add hostname and timestamp to JUnit XML testsuite tag
...
Fix #5471
2019-08-03 15:54:39 +01:00
Bruno Oliveira
d3e1907899
Use OSError subclasses instead of handling errno
2019-08-02 14:17:46 -03:00
Daniel Hahler
b5b710b3ae
Merge master into features
...
Several conflicts, mostly due to 2c402f4bd
.
Conflicts:
.pre-commit-config.yaml
src/_pytest/outcomes.py
src/_pytest/python_api.py
tox.ini
2019-08-02 16:52:51 +02:00
Daniel Hahler
9064eea216
Improve rm_rf to handle only known functions
...
Warnings are emitted if we cannot safely remove
paths.
Fix #5626
2019-08-02 08:18:11 -03:00
Anthony Sottile
1076a7e61d
Merge pull request #5680 from ss18/ss18/pr0
...
Fix some typos
2019-08-01 08:18:48 -07:00
Semen Zhydenko
d19fe3c410
didnt -> didn't
2019-08-01 15:10:39 +02:00
Semen Zhydenko
2de145f372
wasnt -> wasn't
2019-08-01 15:10:06 +02:00
Semen Zhydenko
942fd91995
shouldnt -> shouldn't
2019-08-01 15:09:14 +02:00
Kaiqi
aa13c625da
Change the warning message
2019-07-27 21:06:29 +02:00
Miro Hrončok
ab39502c98
In test_xfail_handling, only remove __pycache__ if it exists
...
Previously, the test failed when the directory was not present,
which could have been caused for example by invoking the tests
with PYTHONDONTWRITEBYTECODE=1.
Fixes https://github.com/pytest-dev/pytest/issues/5664
2019-07-26 02:23:14 +02:00
Daniel Hahler
401c3d1109
tests: unittest: fix/harden "test_exit_outcome"
...
Ref: https://github.com/pytest-dev/pytest/pull/5634#pullrequestreview-265565917
2019-07-23 19:35:51 +02:00
Bruno Oliveira
a82dd2f064
Fix linting
2019-07-23 10:55:22 -03:00
Florian Bruhin
8c47db724c
Improve output when parsing an ini configuration fails
2019-07-23 15:27:27 +02:00
Bruno Oliveira
693e9d0733
Merge pull request #5634 from blueyed/fix-unittest-exit
...
unittest: handle outcomes.Exit
2019-07-23 10:08:43 -03:00
Bruno Oliveira
0824789459
Improve test for pytest.exit handling
2019-07-23 08:53:38 -03:00
Bruno Oliveira
ec4ca59bf0
Merge pull request #5631 from RonnyPfannschmidt/fix-5606
...
use identity checks for the mock sentinels
2019-07-23 08:48:58 -03:00
Daniel Hahler
3c7438969a
Replace internal config._origargs with invocation_params.args
...
Added in https://github.com/pytest-dev/pytest/pull/5564 .
2019-07-23 06:46:56 +02:00
Bruno Oliveira
240d314f36
copy test and changelog from #5607 by @niccodemus
2019-07-20 20:21:27 +02:00
Anthony Sottile
27c9d80a7e
Fix ordering of sys modules snapshot
2019-07-20 11:17:30 -07:00
Daniel Hahler
d35d09f82d
unittest: handle outcomes.Exit
...
This is required for pytest to stop when using "quit" in pdb, and should
get honored/handled in general.
2019-07-20 07:11:49 +02:00
Daniel Hahler
63d517645c
doctest: handle BdbQuit
...
Map `BdbQuit` exception to `outcomes.Exit`.
This is necessary since we are not wrapping `pdb.set_trace` there, and
therefore our `do_quit` is not called.
2019-07-19 02:57:25 +02:00
Ran Benita
faf222f8fb
Merge pull request #5593 from bluetech/type-annotations-1
...
Type-annotate pytest.{exit,skip,fail,xfail,importorskip,warns,raises}
2019-07-16 22:38:20 +03:00
Ran Benita
9258fd1296
Merge pull request #5603 from bluetech/saferepr-simplify
...
Simplify SafeRepr a bit
2019-07-16 22:37:02 +03:00
Bruno Oliveira
65c23017c7
Update test_getfuncargnames_patching to work with modern mock
2019-07-15 12:23:59 -03:00
Bruno Oliveira
8a3f40996a
Remove obsolete "importorskip('unittest.mock')" calls
2019-07-15 11:18:05 -03:00
Ran Benita
129600d698
saferepr: Avoid indirect function calls
...
The DRY savings they provide are rather small, while they make it harder
to type-check, and IMO harder to understand.
2019-07-15 17:07:58 +03:00
Bruno Oliveira
499fda2349
Various cleanups in src/_pytest/python.py ( #5599 )
...
Various cleanups in src/_pytest/python.py
2019-07-14 19:00:35 -03:00
Ran Benita
0394ebffee
saferepr: Use an __init__ instead of setting attributes after construction
...
This will be easier to type-check, and also somewhat clearer.
2019-07-14 22:50:14 +03:00
Ran Benita
11f1f79222
Allow creating ExceptionInfo from existing exc_info for better typing
...
This way the ExceptionInfo generic parameter can be inferred from the
passed-in exc_info. See for example the replaced cast().
2019-07-14 14:28:24 +03:00
Ran Benita
866904ab80
Revert "Let context-managers for raises and warns handle unknown keyword arguments"
...
This reverts commit dfe54cd82f
.
The idea in the commit was to simplify the code by removing the check
and instead letting it TypeError which has the same effect.
However this type error is caught by mypy, and rather than ignoring the
error we think it's better and clearer to go back to the previous
explicit check.
2019-07-14 14:28:21 +03:00
Ronny Pfannschmidt
2c071a060e
refactor resolve_arg_value_types
...
* more explicit type checks
* expand from list+tuple to sequence
2019-07-13 08:13:46 +02:00
Bruno Oliveira
0f8b462677
Include <testsuites> root tag in generated XML ( #5550 )
...
Include <testsuites> root tag in generated XML
2019-07-12 14:35:34 -03:00
Bruno Oliveira
24a66db8d3
Remove support code for unittest 2
...
Also moved a pytest_runtest_makereport hook implemented in
nose.py, but nowadays makes more sense to be implemented in
unittest.py
2019-07-11 20:11:06 -03:00
Bruno Oliveira
37c37963c4
Fix rmtree to remove directories with read-only files
...
Fix #5524
2019-07-11 18:24:53 -03:00
Bruno Oliveira
666acc9b7a
doctest: Add +NUMBER option to ignore irrelevant floating-point… ( #5576 )
...
doctest: Add +NUMBER option to ignore irrelevant floating-point differences
2019-07-11 07:25:37 -03:00
David Röthlisberger
a740ef2036
docs: Document doctest +NUMBER limitation with strings
...
Also added an "xfail" testcase for the same.
2019-07-11 10:06:57 +01:00
David Röthlisberger
4c590e002f
Fix test_doctest.test_number_non_matches
...
These doctests were expected to fail, but they were failing because of a
silly bug (I forgot to replace "{expression}" with the actual expression
to be tested), not because of the thing they were meant to be testing.
Then I had to fix one of the testcases because it was actually matching:
>>> 3.0 #doctest: +NUMBER
2.99
The doctest is saying that the actual output should match to 2 decimal
places, i.e. within 0.01 -- which it is, so it passes. I changed the
expected output to 2.98 and now it doesn't match (as we expect).
2019-07-11 09:57:44 +01:00
Bruno Oliveira
2c402f4bd9
[cherry-pick to master] Add rudimentary mypy type checking ( #5583 )
...
[cherry-pick to master] Add rudimentary mypy type checking
2019-07-10 07:52:32 -03:00
Bruno Oliveira
602cd5e21f
Introduce Config.invocation_params ( #5564 )
...
Introduce Config.invocation_params
2019-07-10 07:46:34 -03:00
Bruno Oliveira
57e5bd0664
Improve type-checking in OutcomeException ( #5580 )
...
Improve type-checking in OutcomeException
2019-07-09 19:12:05 -03:00
Bruno Oliveira
31738155b5
Remove deprecated features ( #5529 )
...
Remove deprecated features
2019-07-09 19:04:06 -03:00
Bruno Oliveira
9db1823707
Improve type-checking in OutcomeException
...
Fix #5578
2019-07-09 18:26:57 -03:00
Ran Benita
89dfde9535
Add rudimentary mypy type checking
...
Add a very lax mypy configuration, add it to tox -e linting, and
fix/ignore the few errors that come up. The idea is to get it running
before diving in too much.
This enables:
- Progressively adding type annotations and enabling more strict
options, which will improve the codebase (IMO).
- Annotating the public API in-line, and eventually exposing it to
library users who use type checkers (with a py.typed file).
Though, none of this is done yet.
Refs https://github.com/pytest-dev/pytest/issues/3342 .
2019-07-09 12:12:07 -07:00
Anthony Sottile
39a43dbae1
Merge pull request #5575 from bluetech/mypy-initial
...
Add rudimentary mypy type checking
2019-07-09 08:05:14 -07:00
Ran Benita
c1167ac552
Add rudimentary mypy type checking
...
Add a very lax mypy configuration, add it to tox -e linting, and
fix/ignore the few errors that come up. The idea is to get it running
before diving in too much.
This enables:
- Progressively adding type annotations and enabling more strict
options, which will improve the codebase (IMO).
- Annotating the public API in-line, and eventually exposing it to
library users who use type checkers (with a py.typed file).
Though, none of this is done yet.
Refs https://github.com/pytest-dev/pytest/issues/3342 .
2019-07-09 10:49:17 +03:00
David Röthlisberger
aaa7e837cc
doctest: Add +NUMBER option to ignore irrelevant floating-point differences
...
When enabled, floating-point numbers only need to match as far as the
precision you have written in the expected doctest output. This avoids
false positives caused by limited floating-point precision, like this:
Expected:
0.233
Got:
0.23300000000000001
This is inspired by Sébastien Boisgérault's [numtest] but the
implementation is a bit different:
* This implementation edits the literals that are in the "got"
string (the actual output from the expression being tested), and then
proceeds to compare the strings literally. This is similar to pytest's
existing ALLOW_UNICODE and ALLOW_BYTES implementation.
* This implementation only compares floats against floats, not ints
against floats. That is, the following doctest will fail with pytest
whereas it would pass with numtest:
>>> math.py # doctest: +NUMBER
3
This behaviour should be less surprising (less false negatives) when
you enable NUMBER globally in pytest.ini.
Advantages of this implementation compared to numtest:
* Doesn't require `import numtest` at the top level of the file.
* Works with pytest (if you try to use pytest & numtest together, pytest
raises "TypeError: unbound method check_output() must be called with
NumTestOutputChecker instance as first argument (got
LiteralsOutputChecker instance instead)").
* Works with Python 3.
[numtest]: https://github.com/boisgera/numtest
2019-07-08 17:07:58 +01:00
Bruno Oliveira
4cda7093f6
Add note about PYTEST_ADDOPTS
2019-07-06 17:27:54 -03:00
Bruno Oliveira
6a9bf2852a
Apply review suggestions: use a simple struct for invocation params
2019-07-06 12:22:19 -03:00
Bruno Oliveira
3e669a262a
Introduce Config.invocation_args and Config.invocation_plugins
...
These attributes can be used to access the unchanged arguments passed
to pytest.main().
The intention is to use these attributes to initialize workers in
the same manner as the master node is initialized in pytest-xdist.
2019-07-05 19:45:23 -03:00
Bruno Oliveira
f1b8431d99
Sort parametrize params to test_external_plugins_integrated
...
This might cause problems during collection with pytest-xdist; we
didn't see any so far mostly by luck I think.
Shame on me for letting that slip in.
2019-07-05 19:05:55 -03:00
Bruno Oliveira
a43ba78d3b
Include <testsuites> root tag in generated XML
...
Fix #5477
2019-07-05 11:29:35 -03:00
Bruno Oliveira
d7588b8d40
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2019-07-05 08:14:18 -03:00
Bruno Oliveira
8651d880a0
Handle xfail(strict=True) properly in --step-wise mode
...
Fix #5547
2019-07-04 20:28:37 -03:00
Miro Hrončok
c54cbd63c8
Replace importlib_metadata with importlib.metadata on Python 3.8+
...
Fixes https://github.com/pytest-dev/pytest/issues/5537
2019-07-04 15:00:10 +02:00
Anthony Sottile
caa08ebd45
Improve quoting in raises match failure message
2019-07-04 05:55:26 -07:00
Bruno Oliveira
0ed7aa2db6
Make 'request' a reserved name for fixtures
2019-06-30 13:31:39 -03:00
Bruno Oliveira
c470ade0a5
Remove 'RemovedInPytest4Warning'
2019-06-30 13:31:39 -03:00
Bruno Oliveira
aa1955de72
Remove 'tmpdir_factory.ensuretemp'
2019-06-30 13:18:07 -03:00
Bruno Oliveira
7e58defc15
Remove 'pytest.config'
2019-06-30 13:18:07 -03:00
Bruno Oliveira
f2b7809d5d
Move setup.cfg error message and tests to an appropriate location
...
Those are not really deprecated anymore and are part of the normal
code for config
2019-06-30 13:18:07 -03:00
Bruno Oliveira
647d89c444
Move code about 'pytest_plugins' error to a more appropriate place
...
It is no longer deprecated, but part of the normal code for 'config'
2019-06-30 13:18:07 -03:00
Bruno Oliveira
683b2632b4
Remove explicit kwargs handling from raises, warns and ParameterSet.param
2019-06-30 13:18:06 -03:00
Bruno Oliveira
13f7f27fd2
Remove 'message' parameter from pytest.raises
2019-06-30 13:18:06 -03:00
Bruno Oliveira
279733a30b
Remove support for 'code as string' from pytest.raises and pytest.warns
2019-06-30 11:40:24 -03:00
Bruno Oliveira
be91c4d932
Remove Request.getfuncargvalue
2019-06-30 11:02:46 -03:00
Anthony Sottile
7ee244476a
Remove astor and reproduce the original assertion expression
2019-06-28 13:38:52 -07:00
Anthony Sottile
4e723d6750
Fix crash when discovery fails while using `-p no:terminal`
2019-06-27 10:24:29 -07:00
Anthony Sottile
3e0e31a364
Don't crash with --pyargs and a filename that looks like a module
2019-06-27 08:32:32 -07:00
Bruno Oliveira
37fb50a3ed
Features assertion pass hook ( #3479 )
...
Features assertion pass hook
2019-06-26 21:14:19 -03:00
Bruno Oliveira
790806e865
Merge pull request #5494 from Zac-HD/funcargnames-to-fixturenames
...
Deprecate funcargnames alias for fixturenames
2019-06-26 21:13:59 -03:00
Bruno Oliveira
2ea22218ff
Cover assertions with messages when enable_assertion_pass_hook is enabled
2019-06-26 20:46:31 -03:00
Bruno Oliveira
eb90f3d1c8
Fix default value of 'enable_assertion_pass_hook'
2019-06-26 17:54:24 -03:00
Victor Maryama
6f851e6cbb
Merge remote-tracking branch 'upstream/master' into features-assertion-pass-hook-master
...
# Conflicts:
# src/_pytest/assertion/rewrite.py
2019-06-26 18:12:56 +02:00
Victor Maryama
f755ff6af1
Black formatting.
2019-06-26 18:10:16 +02:00
Victor Maryama
d638da5821
Using ini-file option instead of cmd option.
2019-06-26 18:10:16 +02:00
Anthony Sottile
3f3f3e7a29
Merge pull request #5495 from nicoddemus/blueyed/cmp-bytes
...
Improve comparison of byte strings (supersedes #5267 )
2019-06-25 19:16:24 -07:00
Bruno Oliveira
3f2344e8f7
Show bytes ascii representation instead of numeric value
2019-06-25 20:40:25 -03:00
Daniel Hahler
8c7eb82363
Fix/improve comparison of byte strings
...
Fixes https://github.com/pytest-dev/pytest/issues/5260 .
2019-06-25 20:15:45 -03:00
Zac Hatfield-Dodds
ed85c83154
Deprecate funcargnames alias
2019-06-26 08:53:17 +10:00
Anthony Sottile
bd647fdd8b
Revert allow_abbrev=False in helper scripts
2019-06-25 14:50:07 -07:00
Victor Maryama
4db5488ed8
Now dependent on command line option.
2019-06-25 19:49:05 +02:00
Victor Maryama
cfbfa53f2b
Using pytester subprocess to avoid keeping references in the HookRecorder.
2019-06-25 17:46:56 +02:00
Victor Maryama
db50a975fd
Reverted leak fixture test.
2019-06-25 17:23:14 +02:00
Bruno Oliveira
019455298b
Merge remote-tracking branch 'upstream/features' into merge-features-into-master
2019-06-25 12:07:54 -03:00
Bruno Oliveira
64a6365227
Include pytest version in the cached pyc tags ( #5484 )
...
Include pytest version in the cached pyc tags
2019-06-25 12:07:01 -03:00
Victor Maryama
81e3f3cf95
Black formatting
2019-06-25 10:41:11 +02:00
Zac Hatfield-Dodds
d72fb73fa0
Do not allow abbreviated arguments
2019-06-25 13:51:33 +10:00
Bruno Oliveira
37fce6c6e5
Pickup addition positional args passed to _parse_parametrize_ar… ( #5483 )
...
Pickup addition positional args passed to _parse_parametrize_args
2019-06-24 22:05:19 -03:00
Kevin J. Foley
95714436a1
Pickup additional positional args passed to _parse_parametrize_args
2019-06-24 20:43:52 -04:00
Bruno Oliveira
f43fb13179
Include pytest version in the cached pyc tags
...
Fix #1671
2019-06-24 20:37:07 -03:00
Bruno Oliveira
3f5b078462
Merge pull request #5441 from nicoddemus/faulthandler-5440
...
Integrate pytest-faulthandler into the core
2019-06-24 20:01:15 -03:00
Anthony Sottile
4cd08f9b52
Switch from deprecated imp to importlib
2019-06-24 09:48:38 -07:00
Victor Maryama
9a89783fbb
Assertion passed hook
2019-06-24 16:09:39 +02:00
Bruno Oliveira
3ce31b6370
Change pytest-faulthandler for simplification
...
* The --no-faulthandler option is not necessary given that we can use
`-p no:faulthandler`.
* The `--faulthandler-timeout` command-line option has become an ini
option, for the reasons described in
https://github.com/pytest-dev/pytest-faulthandler/issues/34 and
users can still set it from the command-line.
Fix pytest-dev/pytest-faulthandler#34
2019-06-22 19:22:43 -03:00
Bruno Oliveira
a37b902afe
Integrate pytest-faulthandler into the core
...
* Add pytest-faulthandler files unchanged
* Adapt imports and tests
* Add code to skip registration of the external `pytest_faulthandler`
to avoid conflicts
Fix #5440
2019-06-21 21:02:24 -03:00
Bruno Oliveira
b38a4e8e11
Fix stepwise crash when first collected module fails ( #5446 )
...
Fix stepwise crash when first collected module fails
2019-06-16 10:43:18 -03:00
Bruno Oliveira
689ce112e7
Small cleanups on _pytest.compat ( #5451 )
...
Small cleanups on _pytest.compat
2019-06-16 10:42:07 -03:00
Bruno Oliveira
87fc5a5455
Make pytest warnings show as from 'pytest' module instead of '_pytest.warning_types' ( #5452 )
...
Make pytest warnings show as from 'pytest' module instead of '_pytest.warning_types'
2019-06-16 10:41:40 -03:00
Bruno Oliveira
bbfc8d1501
conversion of exit codes to enum + exposure ( #5420 )
...
conversion of exit codes to enum + exposure
2019-06-16 10:41:18 -03:00
Daniel Hahler
cf27af734e
Merge pull request #5404 from Zac-HD/helpful-mock-unwrapper
...
Emit warning for broken object
2019-06-15 18:54:03 +02:00
Bruno Oliveira
43e8576ca3
Make pytest warnings show as from 'pytest' module instead of '_pytest.warning_types'
...
When we configure warnings as errors, users see error messages like this:
def test():
> warnings.warn(pytest.PytestWarning("some warning"))
E _pytest.warning_types.PytestWarning: some warning
This is a problem because suggests the user should use `_pytest.warning_types.PytestWarning` to configure
their warning filters, which is not nice.
This commit changes the message to:
def test():
> warnings.warn(pytest.PytestWarning("some warning"))
E pytest.PytestWarning: some warning
2019-06-15 11:48:34 -03:00
Bruno Oliveira
177af032d2
Remove unused/unneeded code
2019-06-15 10:45:16 -03:00
Ronny Pfannschmidt
2b92fee1c3
initial conversion of exit codes to enum
2019-06-15 06:48:00 +02:00
Bruno Oliveira
c94e9b6145
Fix test docstring
2019-06-13 23:10:13 -03:00
Bruno Oliveira
bc345ac980
Remove handling of collection errors by --sw
...
Since then pytest itself adopted the behavior of interrupting
the test session on collection errors, so --sw no longer needs
to handle this.
The --sw behavior seems have been implemented when pytest
would continue execution even if there were collection errors.
2019-06-13 17:19:36 -03:00
Bruno Oliveira
4cc05a657d
Fix --sw crash when first file in cmdline fails to collect
...
Fix #5444
2019-06-13 16:47:01 -03:00
Thomas Grainger
ad15efc7ea
add test for stepwise attribute error Refs: #5444
2019-06-13 12:39:49 +01:00
Bruno Oliveira
52780f39ce
Postpone removal of --result-log to pytest 6.0
...
As we did not provide an alternative yet, it is better to postpone
the actual removal until we have provided a suitable and stable
alternative.
Related to #4488
2019-06-12 08:26:11 -03:00
Zac-HD
c5a549b5bb
Emit warning for broken object
2019-06-09 22:17:40 +10:00
Bruno Oliveira
9f5c356784
Remove ExceptionInfo.__str__, falling back to __repr__ ( #5413 )
...
Remove ExceptionInfo.__str__, falling back to __repr__
2019-06-07 08:48:03 -03:00
Anthony Sottile
ccd87f9e80
small mypy fixes
2019-06-06 09:13:02 -07:00
Bruno Oliveira
65c2a81924
Remove ExceptionInfo.__str__, falling back to __repr__
...
Fix #5412
2019-06-06 12:20:32 -03:00
Bruno Oliveira
9f8b566ea9
Turn PytestDeprecationWarning into error ( #5410 )
...
Turn PytestDeprecationWarning into error
2019-06-05 22:20:14 -03:00
Bruno Oliveira
3656885d0d
Fix verbosity bug in --collect-only ( #5391 )
...
Fix verbosity bug in --collect-only
2019-06-05 20:47:59 -03:00
Thomas Hisch
577b0dffe7
Fix verbosity bug in --collect-only
2019-06-05 20:10:16 -03:00
Bruno Oliveira
8f5cb461a8
Turn PytestDeprecationWarning into error
...
Fix #5402
2019-06-05 19:02:52 -03:00
Daniel Hahler
aab5687093
tests: restore tracing function
...
Without this, `testing/test_pdb.py` (already without pexpect) will cause
missing test coverage afterwards (for the same process).
2019-06-05 11:26:48 +02:00
Anthony Sottile
be2be040f9
Clean up u' prefixes and py2 bytes conversions
2019-06-04 17:50:34 -07:00
Anthony Sottile
0f4992c223
Merge pull request #5393 from nicoddemus/unittest-self-5390
...
item.obj is again a bound method on TestCase function items
2019-06-04 17:48:48 -07:00
Bruno Oliveira
1f8fd421c4
item.obj is again a bound method on TestCase function items
...
Fix #5390
2019-06-04 20:22:49 -03:00
Bruno Oliveira
883db6a216
Add test for packages with broken metadata
...
Related to #5389
2019-06-04 17:04:15 -03:00
Anthony Sottile
1b381d5277
Revert "Unroll calls to any #5062 ( #5103 )"
...
This reverts commit 2b9ca34280
, reversing
changes made to 0a57124063
.
2019-06-03 08:42:03 -07:00
Anthony Sottile
2125d04501
Revert "Fix all() unroll for non-generators/non-list comprehensions ( #5360 )"
...
This reverts commit 733f43b02e
, reversing
changes made to e4fe41ebb7
.
2019-06-03 08:42:03 -07:00
Bruno Oliveira
ce78c9adef
Fix linting
2019-06-03 12:08:50 -03:00
Anthony Sottile
8292644015
Allow multiple positions for the SyntaxError in pypy3.6
2019-06-03 12:08:02 -03:00
Anthony Sottile
96fd44e040
Update line number for warning
2019-06-03 12:08:02 -03:00
Anthony Sottile
5dcf85c17e
manual: remove dependence on six
2019-06-03 12:08:02 -03:00
Anthony Sottile
c63320cc31
codecs.open / io.open
2019-06-03 12:08:02 -03:00
Anthony Sottile
4df529e5b9
Clean up __future__ and coding: in tests
2019-06-03 12:08:02 -03:00
Anthony Sottile
a91fe1fedd
pre-commit run pyupgrade --all-files
2019-06-03 12:08:02 -03:00
Anthony Sottile
3f1ec520fc
pre-commit run reorder-python-imports --all-files
2019-06-03 12:08:01 -03:00
Anthony Sottile
5034399d7a
pre-commit run fix-encoding-pragma --all-files
2019-06-03 12:08:01 -03:00
Thomas Hisch
ef053193b5
logging: Extend LEVELNAME_FMT_REGEX
2019-06-03 05:53:19 +02:00
Bruno Oliveira
4d49ba6529
Drop Python 2.7 and 3.4 support
...
* Update setup.py requires and classifiers
* Drop Python 2.7 and 3.4 from CI
* Update docs dropping 2.7 and 3.4 support
* Fix mock imports and remove tests related to pypi's mock module
* Add py27 and 34 support docs to the sidebar
* Remove usage of six from tmpdir
* Remove six.PY* code blocks
* Remove sys.version_info related code
* Cleanup compat
* Remove obsolete safe_str
* Remove obsolete __unicode__ methods
* Remove compat.PY35 and compat.PY36: not really needed anymore
* Remove unused UNICODE_TYPES
* Remove Jython specific code
* Remove some Python 2 references from docs
Related to #5275
2019-06-02 14:39:11 -03:00
Bruno Oliveira
acdf30a523
Fix all() unroll for non-generators/non-list comprehensions
...
Fix #5358
2019-06-02 12:12:14 -03:00
Anthony Sottile
cafb13c95f
Fix `pytest.mark.parametrize` when the argvalue is an iterator
2019-06-01 15:09:17 -07:00
Anthony Sottile
fb3ae5eaa9
Merge remote-tracking branch 'origin/master' into mm
2019-05-30 20:23:38 -07:00
Bruno Oliveira
c8d23c206b
logging: Improve formatting of multiline message ( #5312 )
...
logging: Improve formatting of multiline message
2019-05-30 21:42:41 -03:00
Victor Maryama
65bd1b8a93
Avoiding looking upwards for parameter argnames when generating fixtureinfo.
2019-05-30 23:42:04 +02:00
Daniel Hahler
ace3a02cd4
pytester: factor out testdir._env_run_update
2019-05-30 17:39:44 +02:00
Daniel Hahler
f013a5e8c1
pytester: use temporary HOME with spawn
...
Followup to https://github.com/pytest-dev/pytest/issues/4956 .
2019-05-30 17:39:44 +02:00
Bruno Oliveira
fbd8ff9502
Merge master into features ( #5339 )
...
Merge master into features
2019-05-30 12:21:51 -03:00
Daniel Hahler
737a1bf947
Merge pull request #5341 from blueyed/auto-slow
...
tests: conftest: auto-add slow marker
2019-05-30 17:01:43 +02:00
Bruno Oliveira
5cbc06a453
Show test module in the PytestCollectionWarning message
...
Related to #5330
2019-05-30 08:18:28 -03:00
Daniel Hahler
28bf3816e7
tests: conftest: auto-add slow marker
2019-05-30 06:55:38 +02:00
Daniel Hahler
6765aca0d1
Merge master into features
2019-05-30 06:33:04 +02:00
Daniel Hahler
fb12d2a612
test_enter_leave_pdb_hooks_are_called: remove child.sendeof()
2019-05-30 03:09:36 +02:00
Daniel Hahler
8e51563384
tests: pdb: flush also on MacOS, but read() before
...
Ref: https://github.com/pytest-dev/pytest/issues/2022
2019-05-30 03:09:36 +02:00
Daniel Hahler
61dfd0a94f
pdb: move/refactor initialization of PytestPdbWrapper
2019-05-30 03:00:07 +02:00
Bruno Oliveira
b10f28949d
Add the junit_log_passing_tests ini flag to skip logging output for passing tests. ( #5052 )
...
Add the junit_log_passing_tests ini flag to skip logging output for passing tests.
2019-05-29 20:56:13 -03:00
Bruno Oliveira
b0f090890c
Merge master into features ( #5332 )
...
Merge master into features
2019-05-29 20:39:27 -03:00
Daniel Hahler
ff80464b47
last-failed: display skipped-files msg always
2019-05-29 23:32:52 +02:00
Daniel Hahler
ceb4f3f701
fixup! Fix regression with --lf and non-selected failures
2019-05-29 23:24:52 +02:00
Thomas Hisch
ea3ebec117
logging: Improve formatting of multiline message
2019-05-29 23:21:14 +02:00
Daniel Hahler
bf3b26b3f7
Fix regression with --lf and non-selected failures
2019-05-29 22:44:43 +02:00
Thomas Hisch
84569ca4da
Merge pull request #5311 from thisch/coloredcaplog
...
Use same code for setting up cli/non-cli formatter
2019-05-29 22:18:43 +02:00
Daniel Hahler
af21e6b45c
Merge master into features
...
(dropping the temporary pinning of pluggy (2e2e895b4
))
2019-05-29 22:15:25 +02:00
Daniel Hahler
61b76c7f5f
tests: conftest: fix collection of slow/slowest items
2019-05-29 21:35:05 +02:00
Thomas Hisch
d4b85da8c7
Use same code for setting up cli/non-cli formatter
...
A method _create_formatter was introduced that is used for both the
log_cli_formatter and the log_formatter.
Consequences of this commit are:
* Captured logs that are output for each failing test are formatted
using the ColoredLevelFromatter.
* The formatter used for writing to a file still uses the non-colored
logging.Formatter class.
2019-05-28 21:30:34 +02:00
Daniel Hahler
0025e4408f
conftest: add uses_pexpect mark
2019-05-28 18:41:01 +02:00
Daniel Hahler
e032904413
Merge master into features
2019-05-28 01:46:16 +02:00
Bruno Oliveira
2b9ca34280
Unroll calls to any #5062 ( #5103 )
...
Unroll calls to any #5062
2019-05-27 20:17:44 -03:00
Anthony Sottile
13f02af97d
Switch to importlib-metadata
2019-05-27 13:24:08 -07:00
Daniel Hahler
f2ed796c41
pdb: import pdbcls lazily
...
Fixes https://github.com/pytest-dev/pytest/issues/2064 .
2019-05-26 15:56:38 +02:00
Anthony Sottile
b3f8fabac8
Merge pull request #5308 from blueyed/minor
...
Minor fixes
2019-05-25 21:58:39 -07:00
Tomer Keren
852fb6a4ae
Change basic test case to be consistent with existing assertion rewriting
...
The code
```
x = 0
assert x == 1
```
will give the failure message 0 == 1, so it shouldn't be different as
part of an unroll
2019-05-25 19:34:08 +03:00
Tomer Keren
437d6452c1
Expand list comprehensions as well
2019-05-25 19:34:08 +03:00
Tomer Keren
ecd2de25a1
Revert "Displaying pip list command's packages and versions #5062"
...
This reverts commit 043fdb7c4065e5eb54f3fb5776077bb8fd651ce6.
These tests were part of the PR #5155 but weren't relevant to #5602
2019-05-25 19:34:08 +03:00
danielx123
c607697400
Fixed test case
2019-05-25 19:34:08 +03:00
danielx123
0996f3dbc5
Displaying pip list command's packages and versions #5062
2019-05-25 19:34:08 +03:00
danielx123
a0dbf2ab99
Adding test cases for unrolling an iterable #5062
2019-05-25 19:34:08 +03:00
Tomer Keren
6b5152ae13
Sanity tests for loop unrolling
2019-05-25 19:34:08 +03:00
Daniel Hahler
10ca84ffc5
Merge pull request #5119 from blueyed/reportopts-A-order
...
reportopts: A: put "Pp" in front
2019-05-24 18:28:43 +02:00
Daniel Hahler
ec6d0fa4d7
Merge pull request #5268 from blueyed/harden-test
...
tests: harden test_nonascii_text
2019-05-24 01:51:35 +02:00
Daniel Hahler
fa8a658458
Merge pull request #4908 from blueyed/pdb-pm-enter-hook
...
pdb: trigger pytest_enter_pdb hook with post-mortem
2019-05-24 01:50:24 +02:00
Bruno Oliveira
66f20b6f5e
Fix invalid Python file encoding "utf8" ( #5252 )
...
Fix invalid Python file encoding "utf8"
2019-05-23 20:24:23 -03:00
Bruno Oliveira
6ba5e3c071
tests: fix test_trace_after_runpytest ( #5245 )
...
tests: fix test_trace_after_runpytest
2019-05-23 19:58:33 -03:00
Daniel Hahler
6c56070df1
Merge pull request #5278 from blueyed/disable-python-plugin
...
Allow disabling of python plugin
2019-05-23 15:52:19 +02:00
Daniel Hahler
f9f41e69a8
reportopts: A: put "Pp" in front
2019-05-23 09:40:16 +02:00
Daniel Hahler
a0ff5deabf
pdb: trigger pytest_enter_pdb hook with post-mortem
...
This is required for pytest-pdb to be called with `--pdb`.
TODO:
- [ ] test
- [ ] pass mode to hook, e.g. "post_mortem" in this case?
2019-05-23 09:09:53 +02:00
Akiomi Kamakura
8a498700da
Add tests for #5286
2019-05-22 03:56:52 +09:00
Daniel Hahler
d19df5efa2
importorskip: display/include ImportError
...
This can provide useful information, e.g.
> could not import 'pyrepl.readline': curses library not found
2019-05-20 14:13:33 +02:00
Daniel Hahler
93fd9debe3
Allow disabling of python plugin
...
Fixes https://github.com/pytest-dev/pytest/issues/5277 .
2019-05-17 18:17:14 +02:00
Daniel Hahler
ff428bfee1
tests: harden test_nonascii_text
2019-05-17 18:06:32 +02:00
Anthony Sottile
dc75b6af47
Use fix-encoding-pragma pre-commit hook
2019-05-14 15:56:31 -07:00
Bruno Oliveira
7573747cda
Normalize all source encoding declarations
2019-05-14 19:42:44 -03:00
Anthony Sottile
4318698bae
Remove 'b' from sys.stdout.mode
2019-05-14 15:00:59 -07:00
Daniel Hahler
c081c01eb1
minor: s/no covers/no cover/
2019-05-14 06:51:49 +02:00
Daniel Hahler
f8e1d58e8f
minor: settrace != set_trace
2019-05-14 06:51:30 +02:00
Raul Tambre
18024467ff
Fix invalid Python file encoding "utf8"
...
Since Python 3 it must be "utf-8", which is the official name.
This is backwards compatible with Python 2.
2019-05-12 19:14:06 +03:00
Daniel Hahler
dda21935a7
tests: fix test_trace_after_runpytest
...
It was not really testing what it was supposed to test (e.g. the inner
test was not run in the first place).
2019-05-12 09:33:34 +02:00
Bruno Oliveira
465b2d998a
Further "unknown marks warning" improvements ( #5178 )
...
Further "unknown marks warning" improvements
2019-05-11 13:28:10 -03:00
Bruno Oliveira
73bbff2b74
Introduce record_testsuite_property fixture
...
This exposes the functionality introduced in fa6acdc
as a session-scoped fixture.
Plugins that want to remain compatible with the `xunit2`
standard should use this fixture instead of `record_property`.
Fix #5202
2019-05-10 19:44:27 -03:00
Bruno Oliveira
0594dba5ce
Remove unused markers and enable --strict-markers
2019-05-09 19:36:39 -03:00
Bruno Oliveira
f1183c2422
Remove the 'issue' marker from test suite
...
It doesn't seem to add much value (why would one execute tests
based on that marker?), plus using the docstring for that
encourages one to write a more descriptive message about the test
2019-05-09 19:36:38 -03:00
Bruno Oliveira
685ca96c71
Change ``--strict`` to ``--strict-markers``, preserving the old one
...
Fix #5023
2019-05-09 19:36:38 -03:00
Bruno Oliveira
ccf6c3cb46
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2019-05-09 19:22:40 -03:00
Daniel Hahler
73b74c74c9
pdb: only use outcomes.exit via do_quit
...
Fixes https://github.com/pytest-dev/pytest/issues/5235 .
2019-05-09 14:55:55 +02:00
Daniel Hahler
5eeb5ee960
Merge pull request #5013 from blueyed/short-summary-message
...
Display message from reprcrash in short test summary
2019-05-08 22:01:04 +02:00
Pulkit Goyal
7e08e09473
logging: improve default logging format (issue5214)
...
We improve the following things in the logging format:
* Show module name instead of just the filename
* show level of logging as the first thing
* show lineno attached to module:file details
Thanks to @blueyed who suggested this on the github issue.
It's my first contribution and I have added myself to AUTHORS.
I also added to a changelog file.
2019-05-08 21:37:59 +03:00
Bruno Oliveira
6d040370ed
Show fixture scopes with ``--fixtures``, except for "function" scope
...
Fix #5220
2019-05-07 14:32:20 -03:00
Bruno Oliveira
1d466d0aa7
Use exec directly ( #5224 )
...
Use exec directly
2019-05-07 10:02:12 -03:00
Bruno Oliveira
ef4dec0bcf
Skip test_source_mtime_long_long on 32bit and lower platforms ( #5045 )
...
Skip test_source_mtime_long_long on 32bit and lower platforms
2019-05-07 09:42:18 -03:00
Anthony Sottile
d1a48ad68f
Use exec directly
2019-05-06 23:07:39 -07:00
Bruno Oliveira
32a5e80a6d
Add encoding: header and fix rep mock in test_line_with_reprcrash on py27
2019-05-05 09:33:37 -03:00
Bruno Oliveira
0e8a8f94f6
Add encoding header to test_terminal.py
2019-05-05 09:14:07 -03:00
Bruno Oliveira
8f23e19bcb
Emit a warning for record_property when used with xunit2
...
"property" elements cannot be children of "testsuite" according to the schema, so it is incompatible with xunit2
Related to #5202
2019-05-05 09:01:13 -03:00
Bruno Oliveira
fc2ad1dbed
Warning subclasses ( #5179 )
...
Warning subclasses
2019-04-29 17:57:49 -03:00
Bruno Oliveira
fb6dad60a0
terminal: use pytest_collection_finish for reporting ( #5113 )
...
terminal: use pytest_collection_finish for reporting
2019-04-29 08:00:48 -03:00
Daniel Hahler
ff5317a7f3
terminal: use pytest_collection_finish for reporting
2019-04-29 05:20:04 +02:00
Bruno Oliveira
08734bdd18
--lf now skips colletion of files without failed tests
...
Fix #5172
2019-04-28 20:23:46 -03:00
Bruno Oliveira
53cd7fd2ea
Introduce new warning subclasses
...
Fix #5177
2019-04-28 10:38:25 -03:00
Daniel Hahler
65133018f3
Terminal plugin is not semi-essential anymore
...
Thanks to https://github.com/pytest-dev/pytest/pull/5138 .
2019-04-27 03:39:00 +02:00
Daniel Hahler
308b733b9d
Revert "Merge pull request #4854 from blueyed/pdb-skip"
...
This reverts commit e88aa957ae
, reversing
changes made to 1410d3dc9a
.
I do not think it warrants an option anymore, and there is a way to
achieve this via `--pdbcls` if needed.
2019-04-27 02:25:38 +02:00
Daniel Hahler
7f519f8ab7
Merge master into features
2019-04-27 00:43:00 +02:00
Nikolay Kondratyev
bc00d0f7db
Fix handle repr error with showlocals and verbose output
2019-04-19 18:54:21 +03:00
Daniel Hahler
e3e57a755b
Merge pull request #5083 from blueyed/capture-_suspended
...
capture: store _state
2019-04-19 17:32:54 +02:00
Daniel Hahler
79d5fc3a0b
Merge pull request #5144 from blueyed/sessionfinish-exitstatus
...
pytest_sessionfinish: preset exitstatus with UsageErrors
2019-04-19 17:30:01 +02:00
Daniel Hahler
f75f7c1925
conftest: use a hookwrapper with sorting faster tests first
2019-04-19 01:23:34 +02:00
Daniel Hahler
698c4e75fd
capture: track current state in _state attributes
...
This is meant for debugging, and making assertions later.
2019-04-19 00:35:15 +02:00
Daniel Hahler
649d23c8a8
pytest_sessionfinish: preset exitstatus with UsageErrors
...
Previously it would be 0. Setting it to the expected outcome
(EXIT_USAGEERROR) here already helps `pytest_sessionfinish` hooks.
2019-04-18 23:18:59 +02:00
Ilya Konstantinov
d67d68f6d3
Eliminate core dependency on 'terminal' plugin
2019-04-17 11:19:19 -07:00
Daniel Hahler
c3178a176d
move test
2019-04-17 15:30:34 +02:00
Daniel Hahler
df1d1105b0
Merge remote-tracking branch 'origin/features' into short-summary-message
...
Conflicts:
src/_pytest/skipping.py
2019-04-17 15:30:19 +02:00
Bruno Oliveira
b64d9402ca
Merge pull request #5108 from blueyed/summary
...
terminal summary: display passes after warnings
2019-04-15 14:49:01 -03:00
Daniel Hahler
ea79eb5c3f
terminal summary: display passes after warnings
...
This displays passes (with output, `-rP`) before the short summary, and
before any other output from other plugins also.
2019-04-15 16:31:42 +02:00
Bruno Oliveira
852ca7ad59
Merge pull request #5114 from blueyed/fixtest
...
test_pytest_exit_returncode: ignore ResourceWarnings
2019-04-15 11:25:16 -03:00
Daniel Hahler
45ba736c81
Merge pull request #5128 from blueyed/mark-is
...
Fix error message with unregistered markers
2019-04-15 16:23:54 +02:00
Daniel Hahler
cc005af47e
Fix error message with unregistered markers
2019-04-15 10:15:37 +02:00
Daniel Hahler
f1f1862b19
Update testing/test_runner.py
2019-04-14 23:26:56 +02:00
Daniel Hahler
6f0a5789fb
Merge master into features
2019-04-14 23:22:21 +02:00
Daniel Hahler
1dd5f088fa
test_pytest_exit_returncode: ignore ResourceWarnings
...
Fixes https://github.com/pytest-dev/pytest/issues/5088 .
2019-04-14 21:55:15 +02:00
Daniel Hahler
8fd5a658eb
monkeypatch.syspath_prepend: invalidate import cache
...
This was done with testdir only, and uses the fixed monkeypatch method
there now.
2019-04-13 16:15:44 +02:00
Anthony Sottile
43e7401c91
Produce a warning when unknown arguments are passed to pytest.param()
2019-04-12 13:00:39 -07:00
Anthony Sottile
da2e092163
pre-commit autoupdate
2019-04-12 04:52:47 -07:00
Bruno Oliveira
19035f4b55
Merge pull request #5068 from blueyed/reportchars
...
Add support for reportchars=A (`-rA`)
2019-04-12 08:13:22 -03:00
Samuel Searles-Bryant
a37d1df089
Show XFail reason as part of JUnitXML message field
...
Fixes #4907
2019-04-11 22:26:05 +01:00
Daniel Hahler
8b2fcf517c
Merge master
2019-04-11 13:28:36 +02:00
Daniel Hahler
b3759372ad
Merge pull request #5082 from blueyed/pytester-raise_on_kwargs
...
pytester: improve/fix kwargs validation
2019-04-11 00:46:18 +02:00