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
09096f7436
Remove 'experimental' status from report serialization hooks
2019-10-30 09:43:33 -03:00
Bruno Oliveira
b99661b9d7
Introduce --report-log option
...
Fix #4488
2019-10-30 09:43:33 -03: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
Ran Benita
7f8bf4d9f6
Merge pull request #6066 from bluetech/type-annotations-paths
...
Add type annotations to _pytest.pathlib and _pytest.tmpdir
2019-10-28 15:20:45 +02:00
Daniel Hahler
ec27363748
Merge pull request #6025 from blueyed/pytester-typing
...
pytester: typing
2019-10-28 05:31:31 +01:00
Daniel Hahler
716f532a38
Merge pull request #6070 from blueyed/pexpect-freebsd
...
pytester: spawn: do not skip FreeBSD
2019-10-28 05:13:31 +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
a4faac6c94
mark: move pytest_cmdline_main.tryfist into decorator
...
Avoids comments for ignored typing.
2019-10-27 06:01:18 +01:00
Daniel Hahler
7f1af84f47
Merge master into features
...
Conflicts:
src/_pytest/logging.py
2019-10-27 02:06:36 +01:00
Daniel Hahler
8e8a8fa4b9
pytester: spawn: do not skip FreeBSD
...
Fixes https://github.com/pytest-dev/pytest/issues/6069
2019-10-27 00:44:25 +02:00
Ran Benita
00a278cdb4
Add type annotations to _pytest.tmpdir
...
At least the ones I was able to.
2019-10-26 20:30:44 +03:00
Ran Benita
59a59f371b
Add type annotations to _pytest.pathlib
...
At least the ones I was sure of.
2019-10-26 20:08:36 +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
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
Anton Lodder
3c7fbe2d8b
Document evaluating complex number for infinity
2019-10-25 12:03:03 -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
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
Bruno Oliveira
432e5550e5
assertrepr_compare: use safeformat with -vv ( #5936 )
...
assertrepr_compare: use safeformat with -vv
2019-10-23 19:51:40 -03:00
Daniel Hahler
8316d4392a
Merge pull request #6028 from blueyed/DontReadFromInput-msg
...
capture: improve message with DontReadFromInput's IOError
2019-10-23 22:48:15 +02: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
Ran Benita
1cc1ac5183
Remove some type: ignores fixed in typeshed
2019-10-23 14:47:56 +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
0267b25c66
Fix some check_untyped_defs mypy errors in terminal
2019-10-23 14:20:15 +03:00
Ran Benita
5dca7a2f4f
Fix check_untyped_defs errors in cacheprovider
2019-10-23 14:20:15 +03:00
Ran Benita
93c8822f26
Fix check_untyped_defs errors in warnings
2019-10-23 14:20:15 +03:00
Ran Benita
583c2a2f9b
Fix check_untyped_defs errors in logging
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
Ran Benita
3246d8a6e9
Merge pull request #6048 from bluetech/mypy-0.740
...
Update mypy 0.720 -> 0.740
2019-10-23 12:47:21 +03:00
Daniel Hahler
b30e7bd1de
Merge pull request #6045 from blueyed/minor
...
minor: typing for ReprFailDoctest
2019-10-23 11:44:37 +02: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
1371b01f78
typing for ReprFailDoctest
2019-10-23 10:52:42 +02:00
Ran Benita
52b85f6f1a
Update mypy 0.720 -> 0.740
...
Changelogs:
http://mypy-lang.blogspot.com/2019/09/mypy-730-released.html
http://mypy-lang.blogspot.com/2019/10/mypy-0740-released.html
New errors:
src/_pytest/recwarn.py:77: error: Missing return statement
src/_pytest/recwarn.py:185: error: "bool" is invalid as return type for "__exit__" that always returns False
src/_pytest/recwarn.py:185: note: Use "typing_extensions.Literal[False]" as the return type or change it to "None"
src/_pytest/recwarn.py:185: note: If return type of "__exit__" implies that it may return True, the context manager may swallow exceptions
src/_pytest/recwarn.py:185: error: Return type "bool" of "__exit__" incompatible with return type "None" in supertype "catch_warnings"
src/_pytest/recwarn.py:230: error: "bool" is invalid as return type for "__exit__" that always returns False
src/_pytest/recwarn.py:230: note: Use "typing_extensions.Literal[False]" as the return type or change it to "None"
src/_pytest/recwarn.py:230: note: If return type of "__exit__" implies that it may return True, the context manager may swallow exceptions
src/_pytest/recwarn.py:230: error: Return type "bool" of "__exit__" incompatible with return type "None" in supertype "catch_warnings"
The errors are due to this new error:
https://mypy.readthedocs.io/en/latest/error_code_list.html#check-the-return-type-of-exit-exit-return
2019-10-23 10:34:14 +03: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
046aa0b6e9
pytest.main: return ExitCode
2019-10-23 04:33:05 +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
bae22e1fdd
Merge pull request #6016 from blueyed/pytest-_ensure_unconfigure-twice
...
pytester: parseconfigure: remove duplicate config._ensure_unconfigure
2019-10-23 01:39:23 +02:00
Bruno Oliveira
215be88fed
Minor: help / direct usage of config ( #6011 )
...
Minor: help / direct usage of config
2019-10-22 20:24:08 -03:00
Daniel Hahler
98fc9377d9
Merge pull request #5630 from blueyed/pdb-doctest-bdbquit
...
doctest: handle BdbQuit
2019-10-23 01:10:19 +02:00
Daniel Hahler
8683293031
Merge pull request #6017 from blueyed/DontReadFromInput-remove-comment
...
Remove (rejected) comment from DontReadFromInput
2019-10-23 01:07:12 +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
3c14dd7f55
capture: improve message with DontReadFromInput's IOError
...
Ref: https://github.com/pytest-dev/pytest/pull/4996#issuecomment-479686487
2019-10-22 02:03:18 +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
Daniel Hahler
995990c61b
Remove (rejected) comment from DontReadFromInput
...
Ref: https://github.com/pytest-dev/pytest/pull/4996#issuecomment-479686487
2019-10-21 02:26:29 +02:00
Daniel Hahler
b47f57a08a
pytester: parseconfigure: remove duplicate config._ensure_unconfigure
...
This gets done in `parseconfig` already.
2019-10-21 01:15:27 +02:00
Daniil Galiev
5cefcb2052
refactor disabling markers
2019-10-21 00:11:24 +02:00
Daniil Galiev
b94eb4cb7b
disable _ALLOW_MARKERS in module __init__.py
2019-10-21 00:11:24 +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
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
a6152db84a
setuponly: pytest_fixture_setup: use option directly
2019-10-20 17:57:25 +02:00
Daniel Hahler
83351a3368
doc: improve help for filterwarnings
2019-10-20 17:56:59 +02: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
Daniel Hahler
9b673bcc44
Improve/revisit CallInfo.__repr__ ( #6007 )
2019-10-19 21:45:27 +02: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
119bf66d7a
ExceptionInfo.from_current: pass through exprinfo ( #6002 )
2019-10-19 19:20:55 +02:00
Daniel Hahler
15f9568694
Improve/revisit CallInfo.__repr__
2019-10-19 19:07:11 +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
cd753aa4ab
ExceptionInfo.from_current: pass through exprinfo
...
This was lost in 11f1f79222
.
2019-10-19 03:02:47 +02:00
Philipp Loose
afac1f0021
Remove unreachable code from config._prepareconfig
...
The code that could trigger the execution of the removed lines was
removed with a7e4016
.
2019-10-18 23:11:41 +02:00
Daniel Hahler
ab245ccdc3
help: display default verbosity
2019-10-18 22:11:54 +02:00
Daniel Hahler
0976e2f50d
Merge master into features
2019-10-18 17:51:42 +02:00
Bruno Oliveira
77a995ffad
Add missing version added/changed markers to docs ( #5966 )
...
Add missing version added/changed markers to docs
2019-10-16 10:43:45 -03:00
Bruno Oliveira
0383d43645
Add missing version added/changed markers to docs
...
Notice some features since 5.0 were not being properly
marked in which version they have been added/changed.
2019-10-15 19:45:58 -03:00
Daniel Hahler
71a7fd02a5
doc: caplog: add caplog.messages
2019-10-15 16:18:50 +02:00
Victor Maryama
122cf60b27
Always creating list for consistency.
...
Co-Authored-By: Bruno Oliveira <nicoddemus@gmail.com>
2019-10-12 15:46:28 +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
2a2fe7d3db
Improve ExceptionInfo.__repr__
2019-10-09 19:27:46 +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
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
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
Anthony Sottile
07792c7113
Fix attribute docs in _pytest.pytester
2019-09-28 18:19:53 -07:00
Bruno Oliveira
7bdfba3578
Fix --setup-only and --setup-show for custom pytest items
...
Fix #5884
2019-09-28 11:52:09 -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
Andrzej Klajnert
f2f3ced508
Fixed the fixture function signature.
2019-09-10 16:20:44 +02:00
Anthony Sottile
9d7b919c7d
Fix pypy3.6 on windows
2019-09-07 16:49:05 -07: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
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
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
3c82b1cb97
Refactor report serialization/deserialization code
...
Refactoring this in order to support chained exceptions
more easily.
Related to #5786
2019-08-26 10:54:25 -03:00
linchiwei123
a4adf511fc
Fix TypeError
...
can only concatenate str (not "bytes") to str
2019-08-24 23:10:17 +08: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
c2f762460f
Merge pull request #5673 from bluetech/type-annotations-3
...
1/X Fix check_untyped_defs = True mypy errors
2019-08-20 17:20:40 +03:00
Ran Benita
43eab917a1
Fix coverage
2019-08-20 15:41:32 +03:00
Robert Holt
62381125e7
Fix self reference in function scoped fixtures
2019-08-19 15:57:39 -04:00
Anthony Sottile
a7ede64f42
Move `@overload` to compat
2019-08-18 14:54:52 -07:00
Daniel Hahler
7c26a65865
minor: make noqa comment more specific
2019-08-17 23:48:55 +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
Ran Benita
9f3bfe82cf
Fix TypeError when importing pytest on Python 3.5.0 and 3.5.1
...
The typing module on these versions have these issues:
- `typing.Pattern` cannot appear in a Union since it is not considered a
class.
- `@overload` is not supported in runtime. (On the other hand, mypy
doesn't support putting it under `if False`, so we need some runtime
hack).
Refs #5751 .
2019-08-17 15:41:59 +03:00
Ran Benita
7259c453d6
Fix some check_untyped_defs = True mypy warnings
2019-08-16 10:41:57 +03:00
Ran Benita
28761c8da1
Have AssertionRewritingHook derive from importlib.abc.MetaPathFinder
...
This is nice for self-documentation, and is the type required by mypy
for adding to sys.meta_path.
2019-08-16 10:41:52 +03:00
Bruno Oliveira
1049a38cee
Fix wording as suggested in review of #5741
2019-08-15 10:05:42 -03: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
1434b66c35
pytester: spawn: skip without pexpect.spawn
...
"pexpect" can be imported on Windows, but does not have "pexpect.spawn"
then.
Ref: https://github.com/pexpect/pexpect/blob/a803933ed53/pexpect/__init__.py#L73-L76
2019-08-13 17:54:40 +02:00
Daniel Hahler
ed2425119f
Merge pull request #5731 from blueyed/assert-compare-maxsize
...
assertrepr_compare: prefer same maxsize
2019-08-12 16:02:41 +02:00
Daniel Hahler
39ba996133
assertion.rewrite: use ast.NameConstant(None) directly
...
`ast.parse("None")` was added/used in 3e6f1fa2d
for differences between
Python 2/3, but we do not support py2 anymore.
2019-08-12 07:50:52 +02: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
345df99db7
Show session duration in human-readable format
...
Fix #5707
2019-08-10 10:45:53 -03:00
Bruno Oliveira
f7e81dab9a
5669: pytester: add docstrings for Testdir.copy_example ( #5719 )
...
5669: pytester: add docstrings for Testdir.copy_example
2019-08-10 09:00:42 -03:00
Ilya Stepin
ee936b27a8
pytester: fix docstrings
...
Co-Authored-By: Bruno Oliveira <nicoddemus@gmail.com>
2019-08-10 09:12:04 +03:00
martbln
e0ce8b79d5
pytester: add docstrings for Testdir.copy_example
2019-08-10 00:59:14 +03:00
Tim Hoffmann
b095e0de47
Improve docs of pytest.importorskip
2019-08-09 21:35:03 +02:00
Daniel Hahler
9f6da8cbeb
Remove unused function CallSpec2.setall
...
Fixes https://github.com/pytest-dev/pytest/issues/5253 .
2019-08-09 16:34:48 +02: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