reut
417b54abed
added option to unicode plugin name
2017-04-05 13:03:11 +00:00
Bruno Oliveira
a542ed48a2
Convert using utf-8 instead of ascii in safe_str()
...
This way we don't lose information and the returned string is
ascii-compatible anyway
2017-03-29 15:18:41 -03:00
Bruno Oliveira
58ac4faf0c
Fix exception formatting while importing test modules
...
Fix #2336
2017-03-29 14:43:13 -03:00
Ronny Pfannschmidt
afb1778294
put in a singular namespace hook to work around the strange issue
2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt
ebeba79be3
remove the namespace hook from mark after the param feature merge
2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt
6165939b0d
fix rebase mistakes
2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt
efe03400d8
fixup nose/pytest plugins
2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt
c9ab421398
fix python2 only import loop failure
2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt
147bb8aea5
correct setting pytest.config
2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt
7cdefce656
fix up oversights
2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt
92f6ab1881
fix all singular internal module imports and add a test for them
2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt
23bc9815c4
remove pytest_namespace from _pytest.fixtures
2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt
ae234786ea
remove pytest_namespace from _pytest.python
2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt
99c8f2d403
remove pytest_namespace from _pytest.main
2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt
61f418a267
hollow out pytest_namespace in _pytest.fixtures
2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt
9b58d6eaca
prepare a own pytest.collect fake module in oder to remove the nested builtin namespaces
2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt
839c936153
_pytest.mark: fix unconfigure after bad configure, still potential bug
2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt
7d797b7dbf
add a note about the deprecation of the pytest_namespace hook
2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt
9b755f6ec6
remove pytest_namespace from _pytest.skipping
2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt
90788defb2
remove pytest_namespace from _pytest.mark and fix latent pytest nesting bug
2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt
6a02cdbb35
remove pytest_namespace from _pytest/runner.py
2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt
c74103f395
remove pytest_namespace from recwarn and fixture decorators
2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt
794fd5658c
remove pytest_namespace from _pytest/debugging.py
2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt
fab9b993f8
remove pytest_namespace from _pytest.freeze_support
2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt
5818e65cf3
remove pytest_namespace from _pytest/assertion
2017-03-28 11:35:29 +02:00
Bruno Oliveira
2c730743f1
Fix errors related to warnings raised by xdist
...
- pytester was creating a 'pexpect' directory to serve as temporary dir, but due to the fact that
xdist adds the current directory to sys.path, that directory was being considered as candidate
for import as a package. The directory is empty and a warning was being raised about
it missing __init__ file, which is now turned into an error by our filterwarnings config
in pytest.ini.
- Decided to play it safe and ignore any warnings during `pytest.importorskip`.
- pytest-xdist and execnet raise two warnings which should be fixed upstream:
pytest-dev/pytest-xdist/issues/133
2017-03-21 22:17:07 -03:00
Bruno Oliveira
fa56114115
Clean up warnings generated by pytest's own suite
2017-03-20 22:13:17 -03:00
Bruno Oliveira
d027f760c0
Avoid displaying the same warning multiple times for an item
2017-03-20 20:40:53 -03:00
Bruno Oliveira
3373e02eae
Add __future__ imports to warnings module
2017-03-20 20:06:01 -03:00
Bruno Oliveira
9f85584656
Merge remote-tracking branch 'upstream/features' into integrate-pytest-warnings
2017-03-20 19:59:05 -03:00
Ronny Pfannschmidt
e368fb4b29
implement pytest.param
...
this allows a clear addition of parameterization parameters that carry along marks
instead of nesting multiple mark objects and destroying the possibility of creating
function valued parameters,
it just folders everything together into one object carrfying parameters, and the marks.
2017-03-17 16:53:43 +01:00
Bruno Oliveira
e5021dc9dc
Replace py.builtin.print_() calls by builtin print() function
2017-03-16 22:46: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
Bruno Oliveira
78194093af
Improve warning representation in terminal plugin and fix tests
2017-03-16 21:57:32 -03:00
Bruno Oliveira
be5db6fa22
Capture warnings around the entire runtestprotocol
...
This is necessary for the warnings plugin to play nice with the
recwarn fixture
2017-03-16 21:54:41 -03:00
Bruno Oliveira
0baed781fe
Merge remote-tracking branch 'upstream/features' into integrate-pytest-warnings
2017-03-16 20:02:06 -03:00
Xander Johnson
dc6890709e
Change ValueError to io.UnsupportedOperation in capture.py. Resolves issue #2276
2017-03-14 18:55:58 -03:00
Bruno Oliveira
fa15ae7545
Post 3.0.7 release handling
2017-03-14 18:07:44 -03:00
Bruno Oliveira
b1ab2ca963
Bump to version 3.0.7 and update CHANGELOG
2017-03-13 18:37:49 -04:00
Bruno Oliveira
22864b75ee
Refactor recwarn to use warnings.catch_warnings instead of custom code
...
Since we dropped 2.5, we can now use warnings.catch_warnings to do the
"catch warnings" magic for us, simplifying the code a bit.
2017-03-13 19:28:36 -03:00
Bruno Oliveira
1e0cf5ce4d
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
...
# Conflicts:
# AUTHORS
# CHANGELOG.rst
# _pytest/pytester.py
2017-03-10 15:54:05 -03:00
fbjorn
cee578e327
Fix trailing whitespace in terminal output
2017-03-05 23:20:55 +03:00
Bruno Oliveira
272afa9422
Display node ids and the warnings generated by it
...
The rationale of using node ids is that users can copy/paste it to run a chosen test
2017-03-04 20:53:42 -03:00
Bruno Oliveira
bddb922f7b
Rename internal option to disable_warnings
2017-03-04 16:32:10 -03:00
Bruno Oliveira
de09023e45
Also capture warnings during setup/teardown
2017-03-04 16:15:03 -03:00
Bruno Oliveira
e24081bf76
Change warning output
2017-03-04 15:59:20 -03:00
Omer Hadari
6a52fe1650
fixed internal error on unprintable raised AssertionErrors
2017-03-04 10:26:46 +02:00
Katerina Koukiou
26e50f1162
junitxml: adjust junitxml output file to comply with JUnit xsd
...
Change XML file structure in the manner that failures in call and errors
in teardown in one test will appear under separate testcase elements in
the XML report.
2017-03-02 15:10:25 +01:00
Bruno Oliveira
3aac3d0a00
Merge branch 'master' into anydbmfix
2017-03-01 14:41:18 -03:00
Anthony Sottile
8b598f00e9
Make pytester use pytest's capture implementation
2017-02-23 17:46:28 -08:00
Anthony Sottile
6ba3475448
Make capsys more like stdio streams in python3. Resolves #1407 .
2017-02-23 17:46:27 -08:00
Katerina Koukiou
d3a6be4130
junitxml: Fix double system-out tags per testcase
...
In the xml report we now have two occurences for the system-out tag if
the testcase writes to stdout both on call and teardown and fails in
teardown.
This behaviour is against the xsd.
This patch makes sure that the system-out section exists only
once per testcase.
2017-02-22 16:39:20 +01:00
Bruno Oliveira
82785fcd40
Use warnings.catch_warnings instead of WarningsRecorder
...
This has the benefical side-effect of not calling the original
warnings.showwarnings function, which in its original form
only writes the formatted warning to sys.stdout.
Calling the original warnings.showwarnings has the effect that nested WarningsRecorder all catch the warnings:
with WarningsRecorder() as rec1:
with WarningsRecorder() as rec2:
warnings.warn(UserWarning, 'some warning')
(both rec1 and rec2 sees the warning)
When running tests with `testdir`, the main pytest session would then see the warnings created by
the internal code being tested (if any), and the main pytest session would end up with warnings as well.
2017-02-18 13:08:14 -02:00
Bruno Oliveira
a7643a5fbe
Merge branch 'features' into integrate-pytest-warnings
2017-02-18 11:03:15 -02:00
Bruno Oliveira
f1900bbea6
Revert subclassing explicitly from object introduced by accident in #2260
2017-02-18 10:34:41 -02:00
Victor Uriarte
a88017cf26
Add note documenting #2257
2017-02-16 23:00:55 -07:00
Victor Uriarte
58d7f4e048
Correct typo
2017-02-16 22:52:06 -07:00
Michal Wajszczuk
fb0b90646e
New-style classes implemented for python 2.7 - #2147
2017-02-16 20:28:17 +01:00
Bruno Oliveira
9c809f5ad0
Merge pull request #2255 from scop/spelling
...
Spelling fixes
2017-02-15 18:41:49 -02:00
Bruno Oliveira
27f12ed0c3
Merge pull request #2254 from scop/py36-escseq
...
Python 3.6 invalid escape sequence deprecation fixes
2017-02-15 18:41:06 -02:00
Ville Skyttä
ede4e9171f
Spelling fixes
2017-02-15 17:00:58 +02:00
Ville Skyttä
eeb6603d71
Python 3.6 invalid escape sequence deprecation fixes
2017-02-15 16:54:53 +02:00
Florian Bruhin
91c6bef77a
Add venv to the default norecursedirs
...
venv (without a dot) is commonly used as a name for a virtualenv directory, and
we don't want to collect that.
2017-02-15 14:55:12 +01:00
Patrick Hayes
58ce3a9e8c
Safer sys.modules delete
2017-02-14 16:54:32 -08:00
Bruno Oliveira
9eb1d73951
--override-ini now correctly overrides some fundamental options like "python_files"
...
#2238
2017-02-08 23:03:33 -02:00
Bruno Oliveira
6a097aa0f1
Merge branch 'master' into allow_skipping_unittests_with_pdb_active
2017-02-08 20:30:14 -02:00
Ran Benita
3a0a0c2df9
Ignore errors raised from descriptors when collecting fixtures
...
Descriptors (e.g. properties) such as in the added test case are
triggered during collection, executing arbitrary code which can raise.
Previously, such exceptions were propagated and failed the collection.
Now these exceptions are caught and the corresponding attributes are
silently ignored.
A better solution would be to completely skip access to all custom
descriptors, such that the offending code doesn't even trigger. However
I think this requires manually going through the instance and all of its
MRO for each and every attribute checking if it might be a proper
fixture before accessing it. So I took the easy route here.
In other words, putting something like this in your test class is still
a bad idea...:
@property
def innocent(self):
os.system('rm -rf /')
Fixes #2234 .
2017-02-07 14:27:34 +02:00
Ran Benita
87fb689ab1
Remove an unneeded `except KeyboardInterrupt`
...
KeyboardInterrupt is a subclass of BaseException, but not of Exception.
Hence if we remove this except, KeyboardInterrupts will still be raised
so the behavior stays the same.
2017-02-07 14:12:09 +02:00
Bruno Oliveira
ccf9877447
Merge pull request #2232 from vidartf/patch-1
...
Do not asssume `Item.obj` in 'skipping' plugin
2017-02-03 21:39:42 -02:00
Bruno Oliveira
a4d2a5785b
Merge pull request #2142 from barneygale/xfail_without_condition_getglobals
...
'xfail' markers without a condition no longer rely on the underlying `Item` objects deriving from `PyobjMixin`
2017-02-03 16:09:47 -02:00
Vidar Tonaas Fauske
bad261279c
Do not asssume `Item.obj` in 'skipping' plugin
...
See #2231 for discussion.
2017-02-03 16:04:34 +01:00
Thomas Kriechbaumer
43662ce789
allow error message matching in pytest.raises
2017-02-02 19:52:33 +01:00
mbyt
ad56cd8027
extract a _handle_skip method, secure PY2 branch
2017-02-02 05:01:51 +01:00
Bruno Oliveira
176c680e19
Merge branch 'master' into allow_skipping_unittests_with_pdb_active
2017-02-01 15:53:14 -02:00
Bruno Oliveira
e1c5314d80
Replace 'raise StopIteration' usages in the code by 'return's in accordance to PEP-479
...
Fix #2160
2017-02-01 02:37:55 -02:00
mbyt
36b6f17727
fixing code-style, keep flake8 happy
2017-01-31 21:03:49 +01:00
mbyt
d1c725078a
Allow to skip unittests if --pdb active
...
closes #2137
2017-01-31 04:47:31 +01:00
Ronny Pfannschmidt
3b47cb45e6
Merge pull request #2222 from RonnyPfannschmidt/features
...
merge master into features
2017-01-26 13:48:10 +01:00
Ronny Pfannschmidt
713bdc1f9f
merge master into features
2017-01-26 12:00:52 +01:00
Ronny Pfannschmidt
c9f327dc87
bump version to next dev
2017-01-22 22:21:08 +01:00
Ronny Pfannschmidt
01eaf9db51
fix the xfail docstring typo at the actual docstring + regendoc
2017-01-22 18:44:30 +01:00
Ronny Pfannschmidt
55f21bd2b9
bump version
2017-01-22 18:44:30 +01:00
Ravi Chandra
0e58c3fa80
updates for PR review #2198
2017-01-21 16:47:49 +13:00
Ravi Chandra
c848d0a771
Pass parameter name to `make_parametrize_id` hook function
2017-01-21 16:46:45 +13:00
Bruno Oliveira
15a3b57ec7
Merge pull request #2120 from RonnyPfannschmidt/fix-2118
...
fix #2118 - rework Node._getcustomclass and Node compat properties
2017-01-20 14:38:55 -02:00
Ronny Pfannschmidt
7b4afd8946
remove unused import
2017-01-20 12:09:49 +01:00
Bruno Oliveira
3766060893
Merge branch 'master' into trial-envs
2017-01-20 08:37:34 -02:00
Ronny Pfannschmidt
4082f4024a
comment out compatproperty deprecations
...
todo: reenable in the features branch
2017-01-20 11:25:48 +01:00
Ronny Pfannschmidt
e0c48b4fe7
Merge pull request #2212 from nicoddemus/pytester-rewrite
...
Assert statements of the pytester plugin again benefit from assertion rewriting
fixes #1920
2017-01-20 10:04:12 +01:00
Bruno Oliveira
7b4368f3f4
Merge pull request #2184 from eli-b/parseoutcomes-explicit-failure
...
Fail assert_outcomes() on missing terminal report
2017-01-19 21:38:54 -02:00
Bruno Oliveira
c477f09177
Assert statements of the pytester plugin again benefit from assertion rewriting
...
Fix #1920
2017-01-19 21:33:51 -02:00
Bruno Oliveira
2574da8d32
Fix pytester internal plugin to work correctly with latest versions of zope.interface
...
Fix #1989
2017-01-19 20:53:35 -02:00
Ronny Pfannschmidt
250597d468
get_real_func: use saferepr when formatting the error message
2017-01-19 13:05:58 +01:00
Ronny Pfannschmidt
123289a88e
fixes #2208 by introducing a iteration limit
2017-01-19 11:38:15 +01:00
Bruno Oliveira
7cd7c283dd
Refactor plugin specs handling into an isolated function
2017-01-12 14:31:35 -02:00
Bruno Oliveira
043aadeaf2
Consider plugins loaded by PYTEST_PLUGINS for assertion rewrite
...
Fix #2185
2017-01-11 17:15:16 -02:00
Eli Boyarski
e18b2a427a
Fail assert_outcomes() on missing terminal report
...
Currently if the terminal report of testdir.runpytest() is missing,
assert_outcomes() on its output fails because parseoutcomes()
returns an unexpected value (None).
It's better to fail parseoutcomes() directly.
2017-01-11 17:09:37 +02:00
mandeep
d4afa1554b
Refactored old style classes to new style classes
2017-01-08 22:52:42 -06:00
Jeff Widman
6d81c684cc
Switch monkeypatch fixture to yield syntax
2017-01-04 15:06:52 -08:00
Loïc Estève
9e9547a9e4
Simplify condition
2017-01-03 10:57:19 -02:00