Commit Graph

233 Commits

Author SHA1 Message Date
Bruno Oliveira 4209ad6fca
Use code highlighting if pygments is installed (#6658)
* Use code highlighting if pygments is installed

* Use colorama constants instead of bare ascii codes

Could not find the exact equivalent of 'hl-reset' code using colorama
constants though.

* Refactor ASCII color handling into a fixture

* Revert back to using explicit color codes

* In Python 3.5 skip rest of tests that require ordered markup in colored output
2020-02-12 08:32:37 -03:00
Bruno Oliveira 78baa7b575 Merge remote-tracking branch 'upstream/master' into mm
Conflicts:
	src/_pytest/main.py
	src/_pytest/mark/structures.py
	src/_pytest/python.py
	testing/test_main.py
	testing/test_parseopt.py
2020-02-11 19:22:28 -03:00
Ran Benita d33da078a8 Move ExitCode's definition from _pytest.main to _pytest.config
ExitCode is used in several internal modules and hooks and so with type
annotations added, needs to be imported a lot.

_pytest.main, being the entry point, generally sits at the top of the
import tree.

So, it's not great to have ExitCode defined in _pytest.main, because it
will cause a lot of import cycles once type annotations are added (in
fact there is already one, which this change removes).

Move it to _pytest.config instead.

_pytest.main still imports ExitCode, so importing from there still
works, although external users should really be importing from `pytest`.
2020-02-10 23:55:06 +02:00
Daniel Hahler 4316fe8a92
testing/conftest.py: testdir: set PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 (#6655)
Fixes https://github.com/pytest-dev/pytest/pull/4518.
2020-02-04 02:59:20 +01:00
Daniel Hahler b5b6e051ed Merge master into features 2020-01-30 02:29:02 +01:00
Daniel Hahler 3ccf2a5e61
Merge pull request #6524 from blueyed/reportchars-default
terminal: default to `fE` with `-r` (reportchars)
2020-01-29 01:00:41 +01:00
Daniel Hahler ddaa5d88ac terminal: default to `fE` with `-r` (reportchars)
Adds handling of `N` to reset `reportchars`, which can be used to get
the old behavior (`-rN`), and also allows for an alternative to
`--disable-warnings` (https://github.com/pytest-dev/pytest/issues/5066),
since `w` was included by default (without `--disable-warnings`).

Fixes https://github.com/pytest-dev/pytest/issues/6454
2020-01-29 00:33:15 +01:00
Daniel Hahler b01e379428 tests: harden test_teardown_many_verbose 2020-01-28 16:37:18 +01:00
Daniel Hahler 30922ee694 Merge master into features 2020-01-28 01:40:14 +01:00
Daniel Hahler 40758e86ca tests: add test_via_exec
Via https://github.com/pytest-dev/pytest/issues/6574.
2020-01-26 23:04:18 +01:00
Bruno Oliveira 93b74d28d2 Merge remote-tracking branch 'upstream/master' into mm
Conflicts:
 * 	src/_pytest/_code/code.py
 * 	src/_pytest/main.py
 * 	testing/python/metafunc.py
 * 	testing/test_parseopt.py
 * 	testing/test_pytester.py
2020-01-22 11:03:45 -03:00
Daniel Hahler 38fc208205 tests: terminal: harden/improve test_color_yes 2020-01-18 15:49:59 +01:00
Daniel Hahler d4d04e7f25 test_terminal: improve color handling 2020-01-18 13:16:27 +01:00
Daniel Hahler 1667cf3350
Merge pull request #6384 from pv/showlocals-short
Make --showlocals work together with --tb=short

Fixes https://github.com/pytest-dev/pytest/issues/494
Ref: https://github.com/pytest-dev/pytest/issues/1715
2020-01-16 22:04:14 +01:00
Daniel Hahler 5049e25a6a tests: cleanup unused fixtures 2020-01-16 21:12:48 +01:00
Daniel Hahler 83813bf515 Merge master into features
Conflicts:
	.github/workflows/main.yml
2020-01-16 19:45:52 +01:00
Pauli Virtanen fd1691a2b3 Make --showlocals work together with --tb=short
Enable showing local variables when asked to do so in the short
traceback mode.

Fixes #494
2020-01-14 21:30:58 +02:00
Daniel Hahler 61d04d3084 terminal: summary_passes: handle teardown sections
Fixes https://github.com/pytest-dev/pytest/issues/2780.
2020-01-11 21:58:19 +01:00
Daniel Hahler 13baab746d terminal: use "yellow" with any "xpassed" tests
Closes https://github.com/pytest-dev/pytest/issues/449.
2020-01-09 22:20:41 +01:00
Bruno Oliveira fa51a26743 Make -r letters "s" and "S" aliases
Similar reasons as the previous commit
2019-12-12 07:48:07 -03:00
Bruno Oliveira 59067ad33d Make -r letters "f" and "F" aliases
As far as the output is concerned, they are both identical so it doesn't
make sense to have both.

setup, teardown, and collect failures are already reported as "errors", "E".
2019-12-12 07:43:37 -03:00
Daniel Hahler a1219ab8fc pytester: use no colors with inline runs by default
Sets `PY_COLORS=0` in the environment by default, which is used by pylib.

Via https://github.com/blueyed/pytest/pull/58

(initially cherry picked from commit f153ad33d10)
2019-11-25 23:48:11 +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 00f67494e5
Merge pull request #6107 from MarcoGorelli/color-percentage-indicator
Color percentage indicator
2019-11-06 00:28:45 +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
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
MarcoGorelli d863c30c74 Fix plurality mismatch for and in pytest terminal summary 2019-10-27 15:16:24 +00:00
Daniel Hahler 7f1af84f47 Merge master into features
Conflicts:
	src/_pytest/logging.py
2019-10-27 02:06:36 +01: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
Daniel Hahler 82753bec50 terminal: report collection errors as "ERROR" in short summary 2019-10-25 07:03:32 +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
Bruno Oliveira 47c2091ecd Use new no-match functions to replace previous idiom 2019-10-06 18:05:24 -03:00
Bruno Oliveira 345df99db7 Show session duration in human-readable format
Fix #5707
2019-08-10 10:45:53 -03:00
Kaiqi aa13c625da Change the warning message 2019-07-27 21:06:29 +02:00
Ronny Pfannschmidt 2b92fee1c3 initial conversion of exit codes to enum 2019-06-15 06:48:00 +02:00
Anthony Sottile be2be040f9 Clean up u' prefixes and py2 bytes conversions 2019-06-04 17:50:34 -07: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
Daniel Hahler e032904413 Merge master into features 2019-05-28 01:46:16 +02:00
Daniel Hahler f9f41e69a8 reportopts: A: put "Pp" in front 2019-05-23 09:40:16 +02:00
Anthony Sottile dc75b6af47 Use fix-encoding-pragma pre-commit hook 2019-05-14 15:56:31 -07: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
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 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
Daniel Hahler c3178a176d move test 2019-04-17 15:30:34 +02:00