Bruno Oliveira
cc0f2473eb
Fix windows console workaround error with non-standard io-streams
...
Fix #2666
2017-08-07 20:57:13 -03:00
Daniel Hahler
0603d1d500
capture: ensure name of EncodedFile being a string
...
Fixes https://github.com/pytest-dev/pytest/issues/2555 .
2017-07-25 20:37:37 +02:00
Segev Finer
d0ecfdf00f
Delete trailing whitespace
2017-07-24 16:55:50 +03:00
Segev Finer
43544a431c
Early import colorama so that it get's the correct terminal
2017-07-24 15:17:39 +03:00
Andras Tim
b840622819
Fixed E302 flake8 errors
...
expected 2 blank lines, found 0
2017-07-17 01:44:23 +02:00
Andras Tim
17a21d540b
Fixed E301 flake8 errors
...
expected 1 blank line, found 0
2017-07-17 01:44:23 +02:00
Andras Tim
195a816522
Fixed E265 flake8 errors
...
block comment should start with ‘# ‘
2017-07-17 01:44:22 +02:00
Andras Tim
8f3eb6dfc7
Fixed E261 flake8 errors
...
at least two spaces before inline comment
2017-07-17 01:44:22 +02:00
Andras Tim
617e510b6e
Fixed E231 flake8 errors
...
missing whitespace after ‘,’, ‘;’, or ‘:’
2017-07-17 01:44:22 +02:00
Segev Finer
59b3693988
Fixed wrong if in the WindowsConsoleIO workaround
2017-06-02 12:34:26 +03:00
Segev Finer
05796be21a
A workaround for Python 3.6 WindowsConsoleIO breaking with FDCapture
...
Python 3.6 implemented unicode console handling for Windows. This works
by reading/writing to the raw console handle using
``{Read,Write}ConsoleW``.
The problem is that we are going to ``dup2`` over the stdio file
descriptors when doing ``FDCapture`` and this will ``CloseHandle`` the
handles used by Python to write to the console. Though there is still some
weirdness and the console handle seems to only be closed randomly and not
on the first call to ``CloseHandle``, or maybe it gets reopened with the
same handle value when we suspend capturing.
The workaround in this case will reopen stdio with a different fd which
also means a different handle by replicating the logic in
"Py_lifecycle.c:initstdio/create_stdio".
See https://github.com/pytest-dev/py/issues/103
2017-06-02 11:19:03 +03:00
Bruno Oliveira
d86c89e193
Revert refactor of old-style to new-style classes
...
As discussed in the mailing list, unfortunately this might break APIs
due to the subtle differences between new and old-style classes (see #2398 ).
This reverts commit d4afa1554b
from PR #2179 .
2017-05-17 18:20:51 -03:00
Bruno Oliveira
42a5d6bdfa
Add __future__ imports to all pytest modules
...
This prevents silly errors from creeping in Python 2 when testing in Python 3
2017-03-16 22:45:40 -03:00
Anthony Sottile
6ba3475448
Make capsys more like stdio streams in python3. Resolves #1407 .
2017-02-23 17:46:27 -08:00
mandeep
d4afa1554b
Refactored old style classes to new style classes
2017-01-08 22:52:42 -06:00
Bruno Oliveira
5ce551e469
Merge pull request #2075 from pytest-dev/master
...
Merge master into features after fixing flake8 errors
2016-11-22 14:10:31 -02:00
Bruno Oliveira
1eb5a690d4
Fix flake8 E305 and E306 errors
...
These errors started to appear with flake8-3.1.1, while they don't appear with
version 3.1.0 (weird).
2016-11-20 18:59:15 -02:00
Vlad Dragos
3444796f3e
Fix formating error.
2016-09-26 13:59:28 +03:00
Vlad Dragos
8985c0be3e
Change exception raised by DontReadFromInput.fileno() from ValueError to io.UnsupportedOperation
2016-09-26 13:15:35 +03:00
Jordan Guymon
a152ea2dbb
Add buffer attribute to stdin stub
2016-08-24 16:26:34 -07:00
Bruno Oliveira
c2864aba3d
Merge branch 'master' into merge-master
...
# Conflicts:
# AUTHORS
# CHANGELOG.rst
# _pytest/monkeypatch.py
# _pytest/python.py
2016-07-25 19:06:29 -03:00
Javi Romero
7e37497d5a
Uppercase first word in docstrings. Change to an imperative form. Add name to authors.
2016-07-22 12:39:06 +02:00
Bruno Oliveira
775100881a
Implement invocation-scoped fixtures
2016-07-09 22:52:05 -03:00
Dave Hunt
ef9dd14963
Introduce pytest command as recommended entry point
...
Fixes #1629
2016-06-21 16:16:57 +02:00
Bruno Oliveira
72bf11cbe9
Add disabled() method to capsys and capfd
...
Fix #1599
2016-06-19 19:14:36 +02:00
Bruno Oliveira
5afb61ad26
Fix trailing white-space
2015-12-25 17:51:55 -02:00
Bruno Oliveira
57bc14caa0
Apply readline workaround during initial conftest loading
2015-12-25 17:46:19 -02:00
Erik M. Bray
6e170a4a1c
* Moved workaround to its own function, mostly for the sake of adding
...
a more descriptive docstring (the workaround itself is just to import
readline earlier). I removed the conditional on targetfd from the
workaround since it doesn't really matter.
* Added # noqa marker.
* Added changelog entry, and self to authors.
2015-12-24 16:43:34 -05:00
Erik M. Bray
924a9667e1
Make sure readline has been imported before duping any stdio handles--otherwise pyreadline fails to connect to the correct handle for the console's stdout/in.
2015-12-24 14:56:57 -05:00
Florian Bruhin
c10f483b9f
Don't hardcode 'std' for captured stdout/stderr.
...
This will make Item.add_report_sect more usable for plugins.
See https://github.com/eisensheng/pytest-catchlog/pull/7
2015-09-22 20:29:16 +02:00
David Szotten
983d249680
reset capture even if readouterr throws
...
otherwise that exception (and all following output) end up in /dev/null
2015-07-26 01:15:51 +02:00
holger krekel
bddc88f09e
adapt to pluggy naming, rename pytest.hookspec_opts to pytest.hookspec,s ame with hookimpl_opts
...
--HG--
branch : pluggy1
2015-05-06 10:08:08 +02:00
holger krekel
d2a5c7f99b
add documented hookimpl_opts and hookspec_opts decorators
...
so that one doesn't have to use pytest.mark or function-attribute setting anymore
--HG--
branch : more_plugin
2015-04-25 11:29:11 +02:00
holger krekel
715a235b45
remove shutdown logic from PluginManager and add a add_cleanup() API
...
for the already existing cleanup logic of the config object.
This simplifies lifecycle management as we don't keep two
layers of shutdown functions and also simplifies the pluginmanager
interface.
also add some docstrings.
--HG--
branch : plugin_no_pytest
2015-04-22 16:33:20 +02:00
holger krekel
0253f7b8d5
remove all occurences of "__multicall__" on hook impls in pytest/*.
...
also simplify pytest_runtest_markereport hook in _pytest/skipping.py
while touching the code anyway.
2014-10-08 20:23:40 +02:00
David Szotten
bc4eecbbac
add `encoding` attr to DontReadFromInput
...
required by https://docs.python.org/2/library/stdtypes.html#file.encoding
and used e.g. by ipdb at _import_ time
--HG--
branch : dontreadfrominput-encoding
2014-09-22 12:19:27 +01:00
Floris Bruynooghe
7d9d502a01
Use py3k compatible .__getattr__() code
...
From the python-dev thread it seemed like using
object.__getattribute__(self, 'name') is the cleanest way of
implementing a class wich uses .__getattr__() and should be
pickelable. That only works on new-style classes so this also turns
HookProxy into a new-style class on py2.
This also re-writes the test to not use cPickle so it runs on py3k.
2014-09-05 23:55:14 +01:00
uweschmitt
224b3a2eda
hopefully final fix for strange infinite recursion bug
2014-08-11 12:57:47 +02:00
uweschmitt
5d024c7433
hopefully final fix for strange infinite recursion bug
2014-08-11 12:42:36 +02:00
uweschmitt
c0d1f3f7ef
even better fix as replacement for last commit which was wrong
2014-08-07 17:17:05 +02:00
uweschmitt
9597d3dafe
better fix as replacement for last commit
2014-08-07 16:56:45 +02:00
uweschmitt
f7282b84bd
fixed strange infinite recursion bug
2014-08-07 16:13:12 +02:00
holger krekel
1d7b574b31
fix issue555: just add "errors" attribute to internal Capture stream.
2014-08-07 11:05:42 +02:00
holger krekel
1265612465
fix issue547 2.6 regression: capsys/capfd now work again when output capturing ("-s") is disabled.
2014-07-28 13:17:37 +02:00
Jurko Gospodnetić
c9bbdf4f10
correct a capfd fixture docstring typo
...
--HG--
branch : fix_capfd_fixture_docstring
2014-04-03 09:59:04 +02:00
holger krekel
3bca62e9e4
fix issue436: improved finding of initial conftest files from command
...
line arguments by using the result of parse_known_args rather than
the previous flaky heuristics. Thanks Marc Abramowitz for tests
and initial fixing approaches in this area.
2014-04-02 11:29:23 +02:00
holger krekel
3b8935c533
remove dupped_stdout logic and related changes, also simplify pytest_runtest_* calls to not use a contextlib with-decorator anymore.
2014-04-01 15:03:17 +02:00
holger krekel
ce8678e6d5
remove non-documented per-conftest capturing option and simplify/refactor all code accordingly. Also make capturing more robust against tests closing FD1/2 and against pdb.set_trace() calls.
2014-04-01 14:32:12 +02:00
holger krekel
2e1f6c85f6
introduce resume/suspend functionality for FDCapture and SysCapture,
...
fixing problems with early bailouts (from argparse's parse() function e.g.)
that wrote to stdout.
2014-04-01 14:19:58 +02:00
holger krekel
ca5e6830c6
avoid some redundancy by using SysCapture from FDCapture for manipulating sys.std{out,in,err}
2014-04-01 14:19:55 +02:00