Commit Graph

6465 Commits

Author SHA1 Message Date
Bruno Oliveira bb5f200ed7 Improve docs for yield-fixture and with statement a bit
Fix #2262
2017-02-25 12:06:51 -03:00
Bruno Oliveira 0f3d7acdc4 Merge pull request #2266 from asottile/capture_v2
Make capsys more like stdio streams in python3. Resolves #1407.
2017-02-24 20:18:55 -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
Ronny Pfannschmidt 0a89db2739 Merge pull request #2271 from KKoukiou/double-tag
junitxml: Fix double system-out tags per testcase
2017-02-22 18:20:17 +01: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 6680cb9100 Merge pull request #2264 from asottile/simplify_travis
Simplify travis.yml with tox environment variables
2017-02-19 18:07:13 -03:00
Floris Bruynooghe 44ad369c17 Merge pull request #2263 from nicoddemus/revert-pluggy
Revert subclassing explicitly from object introduced by accident in #2260
2017-02-19 16:18:38 -03:00
Anthony Sottile 5fd010c4c3 Simplify travis.yml with tox environment variables 2017-02-19 09:02:35 -08: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
Bruno Oliveira 21a09f0895 Merge pull request #2261 from vmuriart/doc-report_header
Document pytest_report_header and conftest behavior
2017-02-17 12:22:28 -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
Bruno Oliveira abd6ad3751 Merge pull request #2260 from MichalTHEDUDE/feature/NewStyleClasses-2147
New-style classes implemented for python 2.7 - #2147
2017-02-16 19:05:09 -02: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
Ronny Pfannschmidt 0a26132232 Merge pull request #2241 from nicoddemus/override-python-files
--override-ini now correctly overrides some fundamental options like "python_files"
2017-02-15 21:40:50 +01:00
Bruno Oliveira da828aac05 Merge pull request #2253 from The-Compiler/norecursedirs
Add venv to the default norecursedirs
2017-02-15 18:40:38 -02:00
Bruno Oliveira 8f98ac5ae8 Fix typo in docs "textures" -> "fixtures" 2017-02-15 13:15:53 -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
Ronny Pfannschmidt 231e2f9a90 Merge pull request #2252 from nicoddemus/fixture-visibility-docs
Improve pytest_plugins docs
2017-02-15 15:53:30 +01:00
Bruno Oliveira c4d974460c Improve pytest_plugins docs
As discussed in #2246
2017-02-15 11:57:03 -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 6b5566db66 Update changelog 2017-02-14 17:47:42 -08:00
Patrick Hayes 49289fed52 Fix docs 2017-02-14 17:21:20 -08:00
Patrick Hayes 00ec30353b Update docs as requested 2017-02-14 17:08:42 -08:00
Patrick Hayes 58ce3a9e8c Safer sys.modules delete 2017-02-14 16:54:32 -08:00
Floris Bruynooghe 427bf42a52 Merge pull request #2247 from flub/flub/training
Mention next training event.
2017-02-14 12:06:13 +00:00
Floris Bruynooghe b536fb7ace Mention next training event. 2017-02-14 11:45:39 +00: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 3d9c5cf19f Merge pull request #2225 from mbyt/allow_skipping_unittests_with_pdb_active
Allow to skip unittests if --pdb active
2017-02-08 21:23:51 -02:00
Bruno Oliveira 6a097aa0f1 Merge branch 'master' into allow_skipping_unittests_with_pdb_active 2017-02-08 20:30:14 -02:00
Bruno Oliveira a4fb971c1f Merge pull request #2235 from bluetech/dont-execute-properties
ignore property errors when parsing fixure factories
2017-02-07 23:41:36 -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 832c89dd5f Test for `pytest.mark.xfail` with non-Python Item 2017-02-03 17:13:05 +01:00
Vidar Tonaas Fauske 1a88a91c7a Update authors/history 2017-02-03 16:29:43 +01: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
Bruno Oliveira 208fae5bf0 Merge pull request #2227 from Kriechi/raises-info
add matching the error message to pytest.raises
2017-02-03 00:56:35 -02:00
Bruno Oliveira abbff681ba Fix '{0}' format for py26 2017-02-02 18:01:44 -02: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
Ronny Pfannschmidt da5a3dba87 Merge pull request #2226 from nicoddemus/raise-stop-iteration
Replace 'raise StopIteration' usages in the code by 'return's in accordance to PEP-479
2017-02-01 14:50:54 +01:00