Daniel Hahler
fb16d3e27a
capture: revisit/fix __repr__, define _in_suspended ( #6749 )
2020-02-20 00:51:57 +01:00
Daniel Hahler
07b7b6fa7d
doc: add docstring for CaptureManager._capturing_for_request ( #6698 )
...
Based on the removed doc for `_install_capture_fixture_on_item`.
Follow-up to https://github.com/pytest-dev/pytest/pull/6663 .
Co-authored-by: Ran Benita <ran234@gmail.com>
2020-02-13 12:09:32 +01:00
Daniel Hahler
f9dd58000a
Fix CaptureManager.__repr__ ( #6697 )
2020-02-10 13:03:05 +01:00
Daniel Hahler
b4ace46c42
capture: cleanup item fixture handling ( #6663 )
...
This started by looking at how to get the current test item in general,
and then I noticed that it is not necessary for the capture plugin to
track it manually in the first place.
2020-02-07 19:23:37 +01:00
Daniel Hahler
30922ee694
Merge master into features
2020-01-28 01:40:14 +01:00
Daniel Hahler
bf5c76359c
fixup! typing: tests: tmpfile
2020-01-26 23:14:32 +01:00
Daniel Hahler
3f8f395210
typing: EncodedFile
2020-01-25 19:20:48 +01:00
Daniel Hahler
039d582b52
Fix `EncodedFile.writelines`
...
This is implemented by the underlying stream already, which additionally
checks if the stream is not closed, and calls `write` per line.
Ref/via: https://github.com/pytest-dev/pytest/pull/6558#issuecomment-578210807
2020-01-25 18:06:50 +01:00
Daniel Hahler
c51173d426
Merge master into features
2020-01-25 14:18:02 +01:00
Tomáš Gavenčiak
5e15c86cc6
Fix EncodedFile.write return value
...
Make EncodedFile, used for captured output streams, method .write return
the number of characters written. Add test for captured stderr write.
Fixes #6557 .
Co-Authored-By: Bruno Oliveira <nicoddemus@gmail.com>
2020-01-25 10:36:23 +01:00
cmachalo
e13ad22364
Include new --capture-mode=tee-sys option
...
Fix #4597
2019-12-09 13:05:23 -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
1787bffda0
Fix check_untyped_defs errors in capture
2019-10-23 14:20:15 +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
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
Anthony Sottile
9d7b919c7d
Fix pypy3.6 on windows
2019-09-07 16:49:05 -07: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
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
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
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
Daniel Hahler
e0b584d048
CaptureFixture: do not crash in _suspend when not started
...
This happened in test_pdb_with_caplog_on_pdb_invocation.
2019-05-23 09:09:53 +02:00
Anthony Sottile
dc75b6af47
Use fix-encoding-pragma pre-commit hook
2019-05-14 15:56:31 -07:00
Anthony Sottile
4318698bae
Remove 'b' from sys.stdout.mode
2019-05-14 15:00:59 -07: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
08ded2927a
capture: do not set logging.raiseExceptions = False
...
Ref: https://github.com/pytest-dev/pytest/issues/4942
2019-04-02 13:20:39 +02:00
Daniel Hahler
951213ee09
Use new suspend/resume in global_and_fixture_disabled
2019-03-28 11:49:01 +01:00
Daniel Hahler
d406786a8d
pdb: handle capturing with fixtures only
2019-03-28 11:49:01 +01:00
Daniel Hahler
da81c1e49a
Merge pull request #4950 from blueyed/capture
...
Revisit capturing module: repr, doc fixes, minor
2019-03-20 01:12:22 +01:00
Daniel Hahler
7395501d1d
Easier read with _colorama_workaround/_readline_workaround
2019-03-19 01:17:21 +01:00
Daniel Hahler
920bffbfbb
Revisit _pytest.capture: repr, doc fixes, minor
2019-03-19 01:17:21 +01:00
Daniel Hahler
98981276a0
capture: fix FDCapture.__repr__ without targetfd_save
2019-03-18 02:33:03 +01:00
Daniel Hahler
a51dc0c7ce
Validate type with writing to captured output like without
...
Fixes https://github.com/pytest-dev/pytest/issues/4861 .
2019-03-01 14:03:51 +01:00
Daniel Hahler
0db5ccb0dd
Merge master into features
2018-12-10 05:42:07 +01:00
Pedro Algarvio
f4d3ec6370
Logging done late enough might happen when capture already stopped.
2018-12-01 21:40:11 +00:00
Daniel Hahler
9ed63c607e
capture: do not overwrite `sys.__stdin__` etc
...
Ref: https://github.com/pytest-dev/pytest/pull/4398#discussion_r234333053
2018-11-20 16:50:15 +01:00
Anthony Sottile
a4819844a4
Use unicode/bytes literals instead of calls
2018-11-04 17:43:24 -08:00
Bruno Oliveira
6befdf8b46
Merge remote-tracking branch 'upstream/master' into release-3.10.0
2018-11-03 13:42:20 +00:00
Daniel Hahler
e0038b82f7
pdb: improve msg about output capturing with set_trace
...
Do not display "IO-capturing turned off/on" when ``-s`` is used to avoid
confusion.
2018-10-31 17:09:01 +01:00
Ville Skyttä
22ab737243
Spelling and grammar fixes
2018-10-29 23:45:45 +02:00
Anthony Sottile
2368fbb63c
Apply reorder-python-imports to all files
2018-10-25 00:01:29 -07:00
Niklas JQ
c14a23d4e4
Fix #4093 : multiple string literals on a line
2018-10-10 19:28:31 +02:00
Bruno Oliveira
f1079a8222
Merge pull request #3832 from Sup3rGeo/bugfix/capsys-with-cli-logging
...
Bugfix/capsys with cli logging (again)
2018-08-21 20:12:31 -03:00
Victor
70ebab3537
Renamed snap_global_capture to read_global_capture.
2018-08-20 17:48:14 +02:00
victor
7ea4992f16
Fixed linting.
2018-08-19 15:46:02 +02:00
victor
8b2c91836b
Fixed activation and used just runtest_protocol hook
2018-08-19 14:30:50 +02:00
victor
7d9b198f73
Refactoring: Separated suspend from snapping (stopped always snapping when suspending - solves bug but still missing tests), reorganized functions and context managers.
2018-08-19 02:32:36 +02:00
Bruno Oliveira
f4c5994d27
Fixtures during teardown can use capsys and capfd to get output from tests
...
Fix #3033
2018-08-18 14:46:24 -03:00
Tyler Richard
273670b2a2
Fixes capfd so data is available after teardown.
2018-08-18 14:11:04 -03:00
Bruno Oliveira
5cf7d1dba2
"suspend" method of capture fixture private
...
Also change the context-manager to global_and_fixture_disabled to
better convey its meaning
2018-08-18 11:38:08 -03:00
Bruno Oliveira
f674217c43
Moved dummy_context_manager to compat module
2018-08-18 11:15:58 -03:00
Bruno Oliveira
9f7345d663
Avoid leaving a reference to the last item on CaptureManager
2018-08-18 11:08:03 -03:00
victor
eb2d074530
Black changes.
2018-08-18 14:27:09 +02:00
victor
9fa7745795
Refactor, tests passing.
2018-08-18 13:40:08 +02:00
victor
14db2f91ba
Fixed global not called if no capsys fixture. Using now capsys context manager as well.
2018-08-18 12:16:47 +02:00
Victor
090f67a980
Refactored implementation and updated tests.
2018-08-17 13:41:26 +02:00
Victor
2b71cb9c38
Added activation/deactivation of capture fixture in logging emit.
2018-08-17 00:26:12 +02:00
Anthony Sottile
cbaa7dd56a
Upgrade pre-commit hooks except pyupgrade
2018-06-26 06:35:27 -07:00
Ronny Pfannschmidt
eaa882f3d5
switch to src layout
2018-05-26 09:10:38 +02:00