Commit Graph

3247 Commits

Author SHA1 Message Date
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