Hello community, here is the log from the commit of package python-pytest for openSUSE:Factory checked in at 2018-02-24 16:37:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pytest (Old) and /work/SRC/openSUSE:Factory/.python-pytest.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest" Sat Feb 24 16:37:21 2018 rev:32 rq:579198 version:3.4.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pytest/python-pytest-doc.changes 2018-02-15 13:20:46.238295551 +0100 +++ /work/SRC/openSUSE:Factory/.python-pytest.new/python-pytest-doc.changes 2018-02-24 16:37:25.089684818 +0100 @@ -1,0 +2,23 @@ +Thu Feb 22 20:37:25 UTC 2018 - mimi...@gmail.com + +- update to 3.4.1 +* Move import of doctest.UnexpectedException to top-level to avoid possible + errors when using --pdb. +* Added printing of captured stdout/stderr before entering pdb, and improved a + test which was giving false negatives about output capturing. +* Fix ordering of tests using parametrized fixtures which can lead to fixtures + being created more than necessary. +* Fix bug where logging happening at hooks outside of "test run" hooks would + cause an internal error. +* Detect arguments injected by unittest.mock.patch decorator correctly when + pypi mock.patch is installed and imported. +* Errors shown when a pytest.raises() with match= fails are now cleaner + on what happened: When no exception was raised, the "matching '...'" part got + removed as it falsely implies that an exception was raised but it didn't + match. When a wrong exception was raised, it's now thrown + instead of complaining about the unmatched text. +* Add Sphinx parameter docs for match and message args to pytest.raises +* Rename ParameterSet._for_parameterize() to _for_parametrize() in + order to comply with the naming convention. + +------------------------------------------------------------------- python-pytest.changes: same change Old: ---- pytest-3.4.0.tar.gz New: ---- pytest-3.4.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pytest-doc.spec ++++++ --- /var/tmp/diff_new_pack.bN2IwB/_old 2018-02-24 16:37:26.193645086 +0100 +++ /var/tmp/diff_new_pack.bN2IwB/_new 2018-02-24 16:37:26.197644942 +0100 @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-pytest-doc -Version: 3.4.0 +Version: 3.4.1 Release: 0 Summary: Documentation for python-pytest, a testing tool with autodiscovery License: MIT python-pytest.spec: same change ++++++ pytest-3.4.0.tar.gz -> pytest-3.4.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/.github/PULL_REQUEST_TEMPLATE.md new/pytest-3.4.1/.github/PULL_REQUEST_TEMPLATE.md --- old/pytest-3.4.0/.github/PULL_REQUEST_TEMPLATE.md 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/.github/PULL_REQUEST_TEMPLATE.md 2018-02-20 22:04:39.000000000 +0100 @@ -1,15 +1,14 @@ Thanks for submitting a PR, your contribution is really appreciated! -Here's a quick checklist that should be present in PRs: +Here's a quick checklist that should be present in PRs (you can delete this text from the final description, this is +just a guideline): -- [ ] Add a new news fragment into the changelog folder - * name it `$issue_id.$type` for example (588.bugfix) - * if you don't have an issue_id change it to the pr id after creating the pr - * ensure type is one of `removal`, `feature`, `bugfix`, `vendor`, `doc` or `trivial` - * Make sure to use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files." -- [ ] Target: for `bugfix`, `vendor`, `doc` or `trivial` fixes, target `master`; for removals or features target `features`; -- [ ] Make sure to include reasonable tests for your change if necessary +- [ ] Create a new changelog file in the `changelog` folder, with a name like `<ISSUE NUMBER>.<TYPE>.rst`. See [changelog/README.rst](/changelog/README.rst) for details. +- [ ] Target the `master` branch for bug fixes, documentation updates and trivial changes. +- [ ] Target the `features` branch for new features and removals/deprecations. +- [ ] Include documentation when adding new features. +- [ ] Include new tests or update existing tests when applicable. -Unless your change is a trivial or a documentation fix (e.g., a typo or reword of a small section) please: +Unless your change is trivial or a small documentation fix (e.g., a typo or reword of a small section) please: -- [ ] Add yourself to `AUTHORS`, in alphabetical order; +- [ ] Add yourself to `AUTHORS` in alphabetical order; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/.travis.yml new/pytest-3.4.1/.travis.yml --- old/pytest-3.4.0/.travis.yml 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/.travis.yml 2018-02-20 22:04:39.000000000 +0100 @@ -2,10 +2,8 @@ language: python python: - '3.6' -# command to install dependencies install: - pip install --upgrade --pre tox -# # command to run tests env: matrix: # coveralls is not listed in tox's envlist, but should run in travis @@ -29,7 +27,7 @@ - TOXENV=doctesting - TOXENV=docs -matrix: +jobs: include: - env: TOXENV=pypy python: 'pypy-5.4' @@ -39,9 +37,22 @@ python: '3.5' - env: TOXENV=py37 python: 'nightly' - allow_failures: - - env: TOXENV=py37 - python: 'nightly' + + - stage: deploy + python: '3.6' + env: + install: pip install -U setuptools setuptools_scm + script: skip + deploy: + provider: pypi + user: nicoddemus + distributions: sdist bdist_wheel + skip_upload_docs: true + password: + secure: xanTgTUu6XDQVqB/0bwJQXoDMnU5tkwZc5koz6mBkkqZhKdNOi2CLoC1XhiSZ+ah24l4V1E0GAqY5kBBcy9d7NVe4WNg4tD095LsHw+CRU6/HCVIFfyk2IZ+FPAlguesCcUiJSXOrlBF+Wj68wEvLoK7EoRFbJeiZ/f91Ww1sbtDlqXABWGHrmhPJL5Wva7o7+wG7JwJowqdZg1pbQExsCc7b53w4v2RBu3D6TJaTAzHiVsW+nUSI67vKI/uf+cR/OixsTfy37wlHgSwihYmrYLFls3V0bSpahCim3bCgMaFZx8S8xrdgJ++PzBCof2HeflFKvW+VCkoYzGEG4NrTWJoNz6ni4red9GdvfjGH3YCjAKS56h9x58zp2E5rpsb/kVq5/45xzV+dq6JRuhQ1nJWjBC6fSKAc/bfwnuFK3EBxNLkvBssLHvsNjj5XG++cB8DdS9wVGUqjpoK4puaXUWFqy4q3S9F86HEsKNgExtieA9qNx+pCIZVs6JCXZNjr0I5eVNzqJIyggNgJG6RyravsU35t9Zd9doL5g4Y7UKmAGTn1Sz24HQ4sMQgXdm2SyD8gEK5je4tlhUvfGtDvMSlstq71kIn9nRpFnqB6MFlbYSEAZmo8dGbCquoUc++6Rum208wcVbrzzVtGlXB/Ow9AbFMYeAGA0+N/K1e59c= + on: + tags: true + repo: pytest-dev/pytest script: tox --recreate diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/AUTHORS new/pytest-3.4.1/AUTHORS --- old/pytest-3.4.0/AUTHORS 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/AUTHORS 2018-02-20 22:04:39.000000000 +0100 @@ -29,6 +29,7 @@ Bernard Pratz Bob Ippolito Brian Dorsey +Brian Maissy Brian Okken Brianna Laugher Bruno Oliveira diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/CHANGELOG.rst new/pytest-3.4.1/CHANGELOG.rst --- old/pytest-3.4.0/CHANGELOG.rst 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/CHANGELOG.rst 2018-02-20 22:04:39.000000000 +0100 @@ -8,6 +8,67 @@ .. towncrier release notes start +Pytest 3.4.1 (2018-02-20) +========================= + +Bug Fixes +--------- + +- Move import of ``doctest.UnexpectedException`` to top-level to avoid possible + errors when using ``--pdb``. (`#1810 + <https://github.com/pytest-dev/pytest/issues/1810>`_) + +- Added printing of captured stdout/stderr before entering pdb, and improved a + test which was giving false negatives about output capturing. (`#3052 + <https://github.com/pytest-dev/pytest/issues/3052>`_) + +- Fix ordering of tests using parametrized fixtures which can lead to fixtures + being created more than necessary. (`#3161 + <https://github.com/pytest-dev/pytest/issues/3161>`_) + +- Fix bug where logging happening at hooks outside of "test run" hooks would + cause an internal error. (`#3184 + <https://github.com/pytest-dev/pytest/issues/3184>`_) + +- Detect arguments injected by ``unittest.mock.patch`` decorator correctly when + pypi ``mock.patch`` is installed and imported. (`#3206 + <https://github.com/pytest-dev/pytest/issues/3206>`_) + +- Errors shown when a ``pytest.raises()`` with ``match=`` fails are now cleaner + on what happened: When no exception was raised, the "matching '...'" part got + removed as it falsely implies that an exception was raised but it didn't + match. When a wrong exception was raised, it's now thrown (like + ``pytest.raised()`` without ``match=`` would) instead of complaining about + the unmatched text. (`#3222 + <https://github.com/pytest-dev/pytest/issues/3222>`_) + +- Fixed output capture handling in doctests on macOS. (`#985 + <https://github.com/pytest-dev/pytest/issues/985>`_) + + +Improved Documentation +---------------------- + +- Add Sphinx parameter docs for ``match`` and ``message`` args to + ``pytest.raises``. (`#3202 + <https://github.com/pytest-dev/pytest/issues/3202>`_) + + +Trivial/Internal Changes +------------------------ + +- pytest has changed the publication procedure and is now being published to + PyPI directly from Travis. (`#3060 + <https://github.com/pytest-dev/pytest/issues/3060>`_) + +- Rename ``ParameterSet._for_parameterize()`` to ``_for_parametrize()`` in + order to comply with the naming convention. (`#3166 + <https://github.com/pytest-dev/pytest/issues/3166>`_) + +- Skip failing pdb/doctest test on mac. (`#985 + <https://github.com/pytest-dev/pytest/issues/985>`_) + + Pytest 3.4.0 (2018-01-30) ========================= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/HOWTORELEASE.rst new/pytest-3.4.1/HOWTORELEASE.rst --- old/pytest-3.4.0/HOWTORELEASE.rst 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/HOWTORELEASE.rst 2018-02-20 22:04:39.000000000 +0100 @@ -22,44 +22,28 @@ Ensure your are in a clean work tree. -#. Generate docs, changelog, announcements and upload a package to - your ``devpi`` staging server:: +#. Generate docs, changelog, announcements and a **local** tag:: - invoke generate.pre-release <VERSION> <DEVPI USER> --password <DEVPI PASSWORD> - - If ``--password`` is not given, it is assumed the user is already logged in ``devpi``. - If you don't have an account, please ask for one. + invoke generate.pre-release <VERSION> #. Open a PR for this branch targeting ``master``. -#. Test the package - - * **Manual method** - - Run from multiple machines:: +#. After all tests pass and the PR has been approved, publish to PyPI by pushing the tag:: - devpi use https://devpi.net/USER/dev - devpi test pytest==VERSION + git push g...@github.com:pytest-dev/pytest.git <VERSION> - Check that tests pass for relevant combinations with:: + Wait for the deploy to complete, then make sure it is `available on PyPI <https://pypi.org/project/pytest>`_. - devpi list pytest +#. Send an email announcement with the contents from:: - * **CI servers** + doc/en/announce/release-<VERSION>.rst - Configure a repository as per-instructions on - devpi-cloud-test_ to test the package on Travis_ and AppVeyor_. - All test environments should pass. + To the following mailing lists: -#. Publish to PyPI:: + * pytest-...@python.org (all releases) + * python-announce-l...@python.org (all releases) + * testing-in-pyt...@lists.idyll.org (only major/minor releases) - invoke generate.publish-release <VERSION> <DEVPI USER> <PYPI_NAME> - - where PYPI_NAME is the name of pypi.python.org as configured in your ``~/.pypirc`` - file `for devpi <http://doc.devpi.net/latest/quickstart-releaseprocess.html?highlight=pypirc#devpi-push-releasing-to-an-external-index>`_. + And announce it on `Twitter <https://twitter.com/>`_ with the ``#pytest`` hashtag. #. After a minor/major release, merge ``release-X.Y.Z`` into ``master`` and push (or open a PR). - -.. _devpi-cloud-test: https://github.com/obestwalter/devpi-cloud-test -.. _AppVeyor: https://www.appveyor.com/ -.. _Travis: https://travis-ci.org diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/PKG-INFO new/pytest-3.4.1/PKG-INFO --- old/pytest-3.4.0/PKG-INFO 2018-01-30 20:51:49.000000000 +0100 +++ new/pytest-3.4.1/PKG-INFO 2018-02-20 22:05:05.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: pytest -Version: 3.4.0 +Version: 3.4.1 Summary: pytest: simple powerful testing with Python Home-page: http://pytest.org Author: Holger Krekel, Bruno Oliveira, Ronny Pfannschmidt, Floris Bruynooghe, Brianna Laugher, Florian Bruhin and others @@ -138,4 +138,5 @@ Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/_pytest/_version.py new/pytest-3.4.1/_pytest/_version.py --- old/pytest-3.4.0/_pytest/_version.py 2018-01-30 20:51:49.000000000 +0100 +++ new/pytest-3.4.1/_pytest/_version.py 2018-02-20 22:05:05.000000000 +0100 @@ -1,4 +1,4 @@ # coding: utf-8 # file generated by setuptools_scm # don't change, don't track in version control -version = '3.4.0' +version = '3.4.1' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/_pytest/compat.py new/pytest-3.4.1/_pytest/compat.py --- old/pytest-3.4.0/_pytest/compat.py 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/_pytest/compat.py 2018-02-20 22:04:39.000000000 +0100 @@ -79,10 +79,11 @@ patchings = getattr(function, "patchings", None) if not patchings: return 0 - mock = sys.modules.get("mock", sys.modules.get("unittest.mock", None)) - if mock is not None: + mock_modules = [sys.modules.get("mock"), sys.modules.get("unittest.mock")] + if any(mock_modules): + sentinels = [m.DEFAULT for m in mock_modules if m is not None] return len([p for p in patchings - if not p.attribute_name and p.new is mock.DEFAULT]) + if not p.attribute_name and p.new in sentinels]) return len(patchings) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/_pytest/debugging.py new/pytest-3.4.1/_pytest/debugging.py --- old/pytest-3.4.0/_pytest/debugging.py 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/_pytest/debugging.py 2018-02-20 22:04:39.000000000 +0100 @@ -2,6 +2,7 @@ from __future__ import absolute_import, division, print_function import pdb import sys +from doctest import UnexpectedException def pytest_addoption(parser): @@ -85,6 +86,17 @@ # for not completely clear reasons. tw = node.config.pluginmanager.getplugin("terminalreporter")._tw tw.line() + + captured_stdout = rep.capstdout + if len(captured_stdout) > 0: + tw.sep(">", "captured stdout") + tw.line(captured_stdout) + + captured_stderr = rep.capstderr + if len(captured_stderr) > 0: + tw.sep(">", "captured stderr") + tw.line(captured_stderr) + tw.sep(">", "traceback") rep.toterminal(tw) tw.sep(">", "entering PDB") @@ -95,10 +107,9 @@ def _postmortem_traceback(excinfo): - # A doctest.UnexpectedException is not useful for post_mortem. - # Use the underlying exception instead: - from doctest import UnexpectedException if isinstance(excinfo.value, UnexpectedException): + # A doctest.UnexpectedException is not useful for post_mortem. + # Use the underlying exception instead: return excinfo.value.exc_info[2] else: return excinfo._excinfo[2] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/_pytest/doctest.py new/pytest-3.4.1/_pytest/doctest.py --- old/pytest-3.4.0/_pytest/doctest.py 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/_pytest/doctest.py 2018-02-20 22:04:39.000000000 +0100 @@ -2,6 +2,8 @@ from __future__ import absolute_import, division, print_function import traceback +import sys +import platform import pytest from _pytest._code.code import ExceptionInfo, ReprFileLocation, TerminalRepr @@ -103,8 +105,21 @@ def runtest(self): _check_all_skipped(self.dtest) + self._disable_output_capturing_for_darwin() self.runner.run(self.dtest) + def _disable_output_capturing_for_darwin(self): + """ + Disable output capturing. Otherwise, stdout is lost to doctest (#985) + """ + if platform.system() != 'Darwin': + return + capman = self.config.pluginmanager.getplugin("capturemanager") + if capman: + out, err = capman.suspend_global_capture(in_=True) + sys.stdout.write(out) + sys.stderr.write(err) + def repr_failure(self, excinfo): import doctest if excinfo.errisinstance((doctest.DocTestFailure, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/_pytest/fixtures.py new/pytest-3.4.1/_pytest/fixtures.py --- old/pytest-3.4.0/_pytest/fixtures.py 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/_pytest/fixtures.py 2018-02-20 22:04:39.000000000 +0100 @@ -166,7 +166,7 @@ items_by_argkey = {} for scopenum in range(0, scopenum_function): argkeys_cache[scopenum] = d = {} - items_by_argkey[scopenum] = item_d = defaultdict(list) + items_by_argkey[scopenum] = item_d = defaultdict(deque) for item in items: keys = OrderedDict.fromkeys(get_parametrized_fixture_keys(item, scopenum)) if keys: @@ -174,12 +174,19 @@ for key in keys: item_d[key].append(item) items = OrderedDict.fromkeys(items) - return list(reorder_items_atscope(items, set(), argkeys_cache, items_by_argkey, 0)) + return list(reorder_items_atscope(items, argkeys_cache, items_by_argkey, 0)) -def reorder_items_atscope(items, ignore, argkeys_cache, items_by_argkey, scopenum): +def fix_cache_order(item, argkeys_cache, items_by_argkey): + for scopenum in range(0, scopenum_function): + for key in argkeys_cache[scopenum].get(item, []): + items_by_argkey[scopenum][key].appendleft(item) + + +def reorder_items_atscope(items, argkeys_cache, items_by_argkey, scopenum): if scopenum >= scopenum_function or len(items) < 3: return items + ignore = set() items_deque = deque(items) items_done = OrderedDict() scoped_items_by_argkey = items_by_argkey[scopenum] @@ -197,13 +204,14 @@ else: slicing_argkey, _ = argkeys.popitem() # we don't have to remove relevant items from later in the deque because they'll just be ignored - for i in reversed(scoped_items_by_argkey[slicing_argkey]): - if i in items: - items_deque.appendleft(i) + matching_items = [i for i in scoped_items_by_argkey[slicing_argkey] if i in items] + for i in reversed(matching_items): + fix_cache_order(i, argkeys_cache, items_by_argkey) + items_deque.appendleft(i) break if no_argkey_group: no_argkey_group = reorder_items_atscope( - no_argkey_group, set(), argkeys_cache, items_by_argkey, scopenum + 1) + no_argkey_group, argkeys_cache, items_by_argkey, scopenum + 1) for item in no_argkey_group: items_done[item] = None ignore.add(slicing_argkey) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/_pytest/logging.py new/pytest-3.4.1/_pytest/logging.py --- old/pytest-3.4.0/_pytest/logging.py 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/_pytest/logging.py 2018-02-20 22:04:39.000000000 +0100 @@ -477,7 +477,7 @@ if not self._first_record_emitted or self._when == 'teardown': self.stream.write('\n') self._first_record_emitted = True - if not self._section_name_shown: + if not self._section_name_shown and self._when: self.stream.section('live log ' + self._when, sep='-', bold=True) self._section_name_shown = True logging.StreamHandler.emit(self, record) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/_pytest/mark.py new/pytest-3.4.1/_pytest/mark.py --- old/pytest-3.4.0/_pytest/mark.py 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/_pytest/mark.py 2018-02-20 22:04:39.000000000 +0100 @@ -75,7 +75,7 @@ return cls(argval, marks=newmarks, id=None) @classmethod - def _for_parameterize(cls, argnames, argvalues, function, config): + def _for_parametrize(cls, argnames, argvalues, function, config): if not isinstance(argnames, (tuple, list)): argnames = [x.strip() for x in argnames.split(",") if x.strip()] force_tuple = len(argnames) == 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/_pytest/python.py new/pytest-3.4.1/_pytest/python.py --- old/pytest-3.4.0/_pytest/python.py 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/_pytest/python.py 2018-02-20 22:04:39.000000000 +0100 @@ -785,7 +785,8 @@ from _pytest.fixtures import scope2index from _pytest.mark import ParameterSet from py.io import saferepr - argnames, parameters = ParameterSet._for_parameterize( + + argnames, parameters = ParameterSet._for_parametrize( argnames, argvalues, self.function, self.config) del argvalues diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/_pytest/python_api.py new/pytest-3.4.1/_pytest/python_api.py --- old/pytest-3.4.0/_pytest/python_api.py 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/_pytest/python_api.py 2018-02-20 22:04:39.000000000 +0100 @@ -453,6 +453,10 @@ Assert that a code block/function call raises ``expected_exception`` and raise a failure exception otherwise. + :arg message: if specified, provides a custom failure message if the + exception is not raised + :arg match: if specified, asserts that the exception matches a text or regex + This helper produces a ``ExceptionInfo()`` object (see below). You may use this function as a context manager:: @@ -567,7 +571,6 @@ message = kwargs.pop("message") if "match" in kwargs: match_expr = kwargs.pop("match") - message += " matching '{0}'".format(match_expr) return RaisesContext(expected_exception, message, match_expr) elif isinstance(args[0], str): code, = args @@ -614,6 +617,6 @@ suppress_exception = issubclass(self.excinfo.type, self.expected_exception) if sys.version_info[0] == 2 and suppress_exception: sys.exc_clear() - if self.match_expr: + if self.match_expr and suppress_exception: self.excinfo.match(self.match_expr) return suppress_exception diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/changelog/1810.bugfix.rst new/pytest-3.4.1/changelog/1810.bugfix.rst --- old/pytest-3.4.0/changelog/1810.bugfix.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-3.4.1/changelog/1810.bugfix.rst 2018-02-20 22:04:39.000000000 +0100 @@ -0,0 +1 @@ +Move import of ``doctest.UnexpectedException`` to top-level to avoid possible errors when using ``--pdb``. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/changelog/3052.bugfix new/pytest-3.4.1/changelog/3052.bugfix --- old/pytest-3.4.0/changelog/3052.bugfix 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-3.4.1/changelog/3052.bugfix 2018-02-20 22:04:39.000000000 +0100 @@ -0,0 +1 @@ +Added printing of captured stdout/stderr before entering pdb, and improved a test which was giving false negatives about output capturing. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/changelog/3060.trivial.rst new/pytest-3.4.1/changelog/3060.trivial.rst --- old/pytest-3.4.0/changelog/3060.trivial.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-3.4.1/changelog/3060.trivial.rst 2018-02-20 22:04:39.000000000 +0100 @@ -0,0 +1 @@ +pytest has changed the publication procedure and is now being published to PyPI directly from Travis. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/changelog/3161.bugfix.rst new/pytest-3.4.1/changelog/3161.bugfix.rst --- old/pytest-3.4.0/changelog/3161.bugfix.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-3.4.1/changelog/3161.bugfix.rst 2018-02-20 22:04:39.000000000 +0100 @@ -0,0 +1 @@ +Fix ordering of tests using parametrized fixtures which can lead to fixtures being created more than necessary. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/changelog/3166.trivial.rst new/pytest-3.4.1/changelog/3166.trivial.rst --- old/pytest-3.4.0/changelog/3166.trivial.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-3.4.1/changelog/3166.trivial.rst 2018-02-20 22:04:39.000000000 +0100 @@ -0,0 +1 @@ +Rename ``ParameterSet._for_parameterize()`` to ``_for_parametrize()`` in order to comply with the naming convention. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/changelog/3184.bugfix new/pytest-3.4.1/changelog/3184.bugfix --- old/pytest-3.4.0/changelog/3184.bugfix 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-3.4.1/changelog/3184.bugfix 2018-02-20 22:04:39.000000000 +0100 @@ -0,0 +1 @@ +Fix bug where logging happening at hooks outside of "test run" hooks would cause an internal error. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/changelog/3202.doc.rst new/pytest-3.4.1/changelog/3202.doc.rst --- old/pytest-3.4.0/changelog/3202.doc.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-3.4.1/changelog/3202.doc.rst 2018-02-20 22:04:39.000000000 +0100 @@ -0,0 +1 @@ +Add Sphinx parameter docs for ``match`` and ``message`` args to ``pytest.raises``. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/changelog/3206.bugfix.rst new/pytest-3.4.1/changelog/3206.bugfix.rst --- old/pytest-3.4.0/changelog/3206.bugfix.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-3.4.1/changelog/3206.bugfix.rst 2018-02-20 22:04:39.000000000 +0100 @@ -0,0 +1 @@ +Detect arguments injected by ``unittest.mock.patch`` decorator correctly when pypi ``mock.patch`` is installed and imported. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/changelog/3222.bugfix new/pytest-3.4.1/changelog/3222.bugfix --- old/pytest-3.4.0/changelog/3222.bugfix 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-3.4.1/changelog/3222.bugfix 2018-02-20 22:04:39.000000000 +0100 @@ -0,0 +1 @@ +Errors shown when a ``pytest.raises()`` with ``match=`` fails are now cleaner on what happened: When no exception was raised, the "matching '...'" part got removed as it falsely implies that an exception was raised but it didn't match. When a wrong exception was raised, it's now thrown (like ``pytest.raised()`` without ``match=`` would) instead of complaining about the unmatched text. \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/changelog/985.bugfix new/pytest-3.4.1/changelog/985.bugfix --- old/pytest-3.4.0/changelog/985.bugfix 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-3.4.1/changelog/985.bugfix 2018-02-20 22:04:39.000000000 +0100 @@ -0,0 +1 @@ +Fixed output capture handling in doctests on macOS. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/changelog/985.trivial.rst new/pytest-3.4.1/changelog/985.trivial.rst --- old/pytest-3.4.0/changelog/985.trivial.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-3.4.1/changelog/985.trivial.rst 2018-02-20 22:04:39.000000000 +0100 @@ -0,0 +1 @@ +Skip failing pdb/doctest test on mac. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/changelog/README.rst new/pytest-3.4.1/changelog/README.rst --- old/pytest-3.4.0/changelog/README.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-3.4.1/changelog/README.rst 2018-02-20 22:04:39.000000000 +0100 @@ -0,0 +1,32 @@ +This directory contains "newsfragments" which are short files that contain a small **ReST**-formatted +text that will be added to the next ``CHANGELOG``. + +The ``CHANGELOG`` will be read by users, so this description should be aimed to pytest users +instead of describing internal changes which are only relevant to the developers. + +Make sure to use full sentences with correct case and punctuation, for example:: + + Fix issue with non-ascii messages from the ``warnings`` module. + +Each file should be named like ``<ISSUE>.<TYPE>.rst``, where +``<ISSUE>`` is an issue number, and ``<TYPE>`` is one of: + +* ``feature``: new user facing features, like new command-line options and new behavior. +* ``bugfix``: fixes a reported bug. +* ``doc``: documentation improvement, like rewording an entire session or adding missing docs. +* ``removal``: feature deprecation or removal. +* ``vendor``: changes in packages vendored in pytest. +* ``trivial``: fixing a small typo or internal change that might be noteworthy. + +So for example: ``123.feature.rst``, ``456.bugfix.rst``. + +If your PR fixes an issue, use that number here. If there is no issue, +then after you submit the PR and get the PR number you can add a +changelog using that instead. + +If you are not sure what issue type to use, don't hesitate to ask in your PR. + +Note that the ``towncrier`` tool will automatically +reflow your text, so it will work best if you stick to a single paragraph, but multiple sentences and links are OK +and encouraged. You can install ``towncrier`` and then run ``towncrier --draft`` +if you want to get a preview of how your change will look in the final release notes. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/doc/en/announce/index.rst new/pytest-3.4.1/doc/en/announce/index.rst --- old/pytest-3.4.0/doc/en/announce/index.rst 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/doc/en/announce/index.rst 2018-02-20 22:04:39.000000000 +0100 @@ -6,6 +6,7 @@ :maxdepth: 2 + release-3.4.1 release-3.4.0 release-3.3.2 release-3.3.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/doc/en/announce/release-3.4.1.rst new/pytest-3.4.1/doc/en/announce/release-3.4.1.rst --- old/pytest-3.4.0/doc/en/announce/release-3.4.1.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-3.4.1/doc/en/announce/release-3.4.1.rst 2018-02-20 22:04:39.000000000 +0100 @@ -0,0 +1,27 @@ +pytest-3.4.1 +======================================= + +pytest 3.4.1 has just been released to PyPI. + +This is a bug-fix release, being a drop-in replacement. To upgrade:: + + pip install --upgrade pytest + +The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. + +Thanks to all who contributed to this release, among them: + +* Aaron +* Alan Velasco +* Andy Freeland +* Brian Maissy +* Bruno Oliveira +* Florian Bruhin +* Jason R. Coombs +* Marcin Bachry +* Pedro Algarvio +* Ronny Pfannschmidt + + +Happy testing, +The pytest Development Team diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/doc/en/example/reportingdemo.rst new/pytest-3.4.1/doc/en/example/reportingdemo.rst --- old/pytest-3.4.0/doc/en/example/reportingdemo.rst 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/doc/en/example/reportingdemo.rst 2018-02-20 22:04:39.000000000 +0100 @@ -358,7 +358,7 @@ > int(s) E ValueError: invalid literal for int() with base 10: 'qwe' - <0-codegen $PYTHON_PREFIX/lib/python3.5/site-packages/_pytest/python_api.py:580>:1: ValueError + <0-codegen $PYTHON_PREFIX/lib/python3.5/site-packages/_pytest/python_api.py:583>:1: ValueError ______________________ TestRaises.test_raises_doesnt _______________________ self = <failure_demo.TestRaises object at 0xdeadbeef> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/doc/en/example/simple.rst new/pytest-3.4.1/doc/en/example/simple.rst --- old/pytest-3.4.0/doc/en/example/simple.rst 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/doc/en/example/simple.rst 2018-02-20 22:04:39.000000000 +0100 @@ -385,8 +385,8 @@ test_some_are_slow.py ... [100%] ========================= slowest 3 test durations ========================= - 0.58s call test_some_are_slow.py::test_funcslow2 - 0.41s call test_some_are_slow.py::test_funcslow1 + 0.30s call test_some_are_slow.py::test_funcslow2 + 0.20s call test_some_are_slow.py::test_funcslow1 0.10s call test_some_are_slow.py::test_funcfast ========================= 3 passed in 0.12 seconds ========================= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/doc/en/writing_plugins.rst new/pytest-3.4.1/doc/en/writing_plugins.rst --- old/pytest-3.4.0/doc/en/writing_plugins.rst 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/doc/en/writing_plugins.rst 2018-02-20 22:04:39.000000000 +0100 @@ -462,19 +462,24 @@ @pytest.hookimpl(hookwrapper=True) def pytest_pyfunc_call(pyfuncitem): - # do whatever you want before the next hook executes + do_something_before_next_hook_executes() outcome = yield # outcome.excinfo may be None or a (cls, val, tb) tuple res = outcome.get_result() # will raise if outcome was exception - # postprocess result + + post_process_result(res) + + outcome.force_result(new_res) # to override the return value to the plugin system Note that hook wrappers don't return results themselves, they merely perform tracing or other side effects around the actual hook implementations. If the result of the underlying hook is a mutable object, they may modify that result but it's probably better to avoid it. +For more information, consult the `pluggy documentation <http://pluggy.readthedocs.io/en/latest/#wrappers>`_. + Hook function ordering / call example ------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/pytest.egg-info/PKG-INFO new/pytest-3.4.1/pytest.egg-info/PKG-INFO --- old/pytest-3.4.0/pytest.egg-info/PKG-INFO 2018-01-30 20:51:49.000000000 +0100 +++ new/pytest-3.4.1/pytest.egg-info/PKG-INFO 2018-02-20 22:05:05.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: pytest -Version: 3.4.0 +Version: 3.4.1 Summary: pytest: simple powerful testing with Python Home-page: http://pytest.org Author: Holger Krekel, Bruno Oliveira, Ronny Pfannschmidt, Floris Bruynooghe, Brianna Laugher, Florian Bruhin and others @@ -138,4 +138,5 @@ Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/pytest.egg-info/SOURCES.txt new/pytest-3.4.1/pytest.egg-info/SOURCES.txt --- old/pytest-3.4.0/pytest.egg-info/SOURCES.txt 2018-01-30 20:51:49.000000000 +0100 +++ new/pytest-3.4.1/pytest.egg-info/SOURCES.txt 2018-02-20 22:05:05.000000000 +0100 @@ -65,6 +65,18 @@ bench/empty.py bench/manyparam.py bench/skip.py +changelog/1810.bugfix.rst +changelog/3052.bugfix +changelog/3060.trivial.rst +changelog/3161.bugfix.rst +changelog/3166.trivial.rst +changelog/3184.bugfix +changelog/3202.doc.rst +changelog/3206.bugfix.rst +changelog/3222.bugfix +changelog/985.bugfix +changelog/985.trivial.rst +changelog/README.rst changelog/_template.rst doc/en/Makefile doc/en/adopt.rst @@ -192,6 +204,7 @@ doc/en/announce/release-3.3.1.rst doc/en/announce/release-3.3.2.rst doc/en/announce/release-3.4.0.rst +doc/en/announce/release-3.4.1.rst doc/en/announce/sprint2016.rst doc/en/example/attic.rst doc/en/example/conftest.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/setup.py new/pytest-3.4.1/setup.py --- old/pytest-3.4.0/setup.py 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/setup.py 2018-02-20 22:04:39.000000000 +0100 @@ -16,7 +16,7 @@ 'Topic :: Utilities', ] + [ ('Programming Language :: Python :: %s' % x) - for x in '2 2.7 3 3.4 3.5 3.6'.split() + for x in '2 2.7 3 3.4 3.5 3.6 3.7'.split() ] with open('README.rst') as fd: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/tasks/generate.py new/pytest-3.4.1/tasks/generate.py --- old/pytest-3.4.0/tasks/generate.py 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/tasks/generate.py 2018-02-20 22:04:39.000000000 +0100 @@ -1,4 +1,6 @@ -import os +""" +Invoke development tasks. +""" from pathlib import Path from subprocess import check_output, check_call @@ -57,7 +59,7 @@ @invoke.task() def make_tag(ctx, version): - """Create a new (local) tag for the release, only if the repository is clean.""" + """Create a new, local tag for the release, only if the repository is clean.""" from git import Repo repo = Repo('.') @@ -74,83 +76,26 @@ repo.create_tag(version) -@invoke.task() -def devpi_upload(ctx, version, user, password=None): - """Creates and uploads a package to devpi for testing.""" - if password: - print("[generate.devpi_upload] devpi login {}".format(user)) - check_call(['devpi', 'login', user, '--password', password]) - - check_call(['devpi', 'use', 'https://devpi.net/{}/dev'.format(user)]) - - env = os.environ.copy() - env['SETUPTOOLS_SCM_PRETEND_VERSION'] = version - check_call(['devpi', 'upload', '--formats', 'sdist,bdist_wheel'], env=env) - print("[generate.devpi_upload] package uploaded") - - @invoke.task(help={ 'version': 'version being released', - 'user': 'name of the user on devpi to stage the generated package', - 'password': 'user password on devpi to stage the generated package ' - '(if not given assumed logged in)', }) -def pre_release(ctx, version, user, password=None): - """Generates new docs, release announcements and uploads a new release to devpi for testing.""" +def pre_release(ctx, version): + """Generates new docs, release announcements and creates a local tag.""" announce(ctx, version) regen(ctx) changelog(ctx, version, write_out=True) msg = 'Preparing release version {}'.format(version) check_call(['git', 'commit', '-a', '-m', msg]) - + make_tag(ctx, version) - devpi_upload(ctx, version=version, user=user, password=password) - print() print('[generate.pre_release] Please push your branch and open a PR.') @invoke.task(help={ 'version': 'version being released', - 'user': 'name of the user on devpi to stage the generated package', - 'pypi_name': 'name of the pypi configuration section in your ~/.pypirc', -}) -def publish_release(ctx, version, user, pypi_name): - """Publishes a package previously created by the 'pre_release' command.""" - from git import Repo - repo = Repo('.') - tag_names = [x.name for x in repo.tags] - if version not in tag_names: - print('Could not find tag for version {}, exiting...'.format(version)) - raise invoke.Exit(code=2) - - check_call(['devpi', 'use', 'https://devpi.net/{}/dev'.format(user)]) - check_call(['devpi', 'push', 'pytest=={}'.format(version), 'pypi:{}'.format(pypi_name)]) - check_call(['git', 'push', 'g...@github.com:pytest-dev/pytest.git', version]) - - emails = [ - 'pytest-...@python.org', - 'python-announce-l...@python.org' - ] - if version.endswith('.0'): - emails.append('testing-in-pyt...@lists.idyll.org') - print('Version {} has been published to PyPI!'.format(version)) - print() - print('Please send an email announcement with the contents from:') - print() - print(' doc/en/announce/release-{}.rst'.format(version)) - print() - print('To the following mail lists:') - print() - print(' ', ','.join(emails)) - print() - print('And announce it on twitter adding the #pytest hash tag.') - - -@invoke.task(help={ - 'version': 'version being released', 'write_out': 'write changes to the actual changelog' }) def changelog(ctx, version, write_out=False): @@ -158,5 +103,4 @@ addopts = [] else: addopts = ['--draft'] - check_call(['towncrier', '--version', version] + addopts) - + check_call(['towncrier', '--yes', '--version', version] + addopts) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/tasks/requirements.txt new/pytest-3.4.1/tasks/requirements.txt --- old/pytest-3.4.0/tasks/requirements.txt 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/tasks/requirements.txt 2018-02-20 22:04:39.000000000 +0100 @@ -1,5 +1,4 @@ -invoke -tox gitpython +invoke towncrier -wheel +tox diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/testing/logging/test_reporting.py new/pytest-3.4.1/testing/logging/test_reporting.py --- old/pytest-3.4.0/testing/logging/test_reporting.py 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/testing/logging/test_reporting.py 2018-02-20 22:04:39.000000000 +0100 @@ -272,6 +272,60 @@ ]) +def test_live_logs_unknown_sections(testdir, request): + """Check that with live logging enable we are printing the correct headers during + start/setup/call/teardown/finish.""" + filename = request.node.name + '.py' + testdir.makeconftest(''' + import pytest + import logging + + def pytest_runtest_protocol(item, nextitem): + logging.warning('Unknown Section!') + + def pytest_runtest_logstart(): + logging.warning('>>>>> START >>>>>') + + def pytest_runtest_logfinish(): + logging.warning('<<<<< END <<<<<<<') + ''') + + testdir.makepyfile(''' + import pytest + import logging + + @pytest.fixture + def fix(request): + logging.warning("log message from setup of {}".format(request.node.name)) + yield + logging.warning("log message from teardown of {}".format(request.node.name)) + + def test_log_1(fix): + logging.warning("log message from test_log_1") + + ''') + testdir.makeini(''' + [pytest] + log_cli=true + ''') + + result = testdir.runpytest() + result.stdout.fnmatch_lines([ + '*WARNING*Unknown Section*', + '{}::test_log_1 '.format(filename), + '*WARNING* >>>>> START >>>>>*', + '*-- live log setup --*', + '*WARNING*log message from setup of test_log_1*', + '*-- live log call --*', + '*WARNING*log message from test_log_1*', + 'PASSED *100%*', + '*-- live log teardown --*', + '*WARNING*log message from teardown of test_log_1*', + '*WARNING* <<<<< END <<<<<<<*', + '=* 1 passed in *=', + ]) + + def test_log_cli_level(testdir): # Default log file level testdir.makepyfile(''' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/testing/python/fixture.py new/pytest-3.4.1/testing/python/fixture.py --- old/pytest-3.4.0/testing/python/fixture.py 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/testing/python/fixture.py 2018-02-20 22:04:39.000000000 +0100 @@ -2168,6 +2168,47 @@ test_mod1.py::test_func1[m2] PASSED """) + def test_dynamic_parametrized_ordering(self, testdir): + testdir.makeini(""" + [pytest] + console_output_style=classic + """) + testdir.makeconftest(""" + import pytest + + def pytest_configure(config): + class DynamicFixturePlugin(object): + @pytest.fixture(scope='session', params=['flavor1', 'flavor2']) + def flavor(self, request): + return request.param + config.pluginmanager.register(DynamicFixturePlugin(), 'flavor-fixture') + + @pytest.fixture(scope='session', params=['vxlan', 'vlan']) + def encap(request): + return request.param + + @pytest.fixture(scope='session', autouse='True') + def reprovision(request, flavor, encap): + pass + """) + testdir.makepyfile(""" + def test(reprovision): + pass + def test2(reprovision): + pass + """) + result = testdir.runpytest("-v") + result.stdout.fnmatch_lines(""" + test_dynamic_parametrized_ordering.py::test[flavor1-vxlan] PASSED + test_dynamic_parametrized_ordering.py::test2[flavor1-vxlan] PASSED + test_dynamic_parametrized_ordering.py::test[flavor2-vxlan] PASSED + test_dynamic_parametrized_ordering.py::test2[flavor2-vxlan] PASSED + test_dynamic_parametrized_ordering.py::test[flavor2-vlan] PASSED + test_dynamic_parametrized_ordering.py::test2[flavor2-vlan] PASSED + test_dynamic_parametrized_ordering.py::test[flavor1-vlan] PASSED + test_dynamic_parametrized_ordering.py::test2[flavor1-vlan] PASSED + """) + def test_class_ordering(self, testdir): testdir.makeini(""" [pytest] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/testing/python/integration.py new/pytest-3.4.1/testing/python/integration.py --- old/pytest-3.4.0/testing/python/integration.py 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/testing/python/integration.py 2018-02-20 22:04:39.000000000 +0100 @@ -147,6 +147,28 @@ reprec = testdir.inline_run() reprec.assertoutcome(passed=1) + def test_unittest_mock_and_pypi_mock(self, testdir): + pytest.importorskip("unittest.mock") + pytest.importorskip("mock", "1.0.1") + testdir.makepyfile(""" + import mock + import unittest.mock + class TestBoth(object): + @unittest.mock.patch("os.path.abspath") + def test_hello(self, abspath): + import os + os.path.abspath("hello") + abspath.assert_any_call("hello") + + @mock.patch("os.path.abspath") + def test_hello_mock(self, abspath): + import os + os.path.abspath("hello") + abspath.assert_any_call("hello") + """) + reprec = testdir.inline_run() + reprec.assertoutcome(passed=2) + def test_mock(self, testdir): pytest.importorskip("mock", "1.0.1") testdir.makepyfile(""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/testing/python/raises.py new/pytest-3.4.1/testing/python/raises.py --- old/pytest-3.4.0/testing/python/raises.py 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/testing/python/raises.py 2018-02-20 22:04:39.000000000 +0100 @@ -132,3 +132,13 @@ with pytest.raises(AssertionError, match=expr): with pytest.raises(ValueError, match=msg): int('asdf', base=10) + + def test_raises_match_wrong_type(self): + """Raising an exception with the wrong type and match= given. + + pytest should throw the unexpected exception - the pattern match is not + really relevant if we got a different exception. + """ + with pytest.raises(ValueError): + with pytest.raises(IndexError, match='nomatch'): + int('asdf') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/testing/test_pdb.py new/pytest-3.4.1/testing/test_pdb.py --- old/pytest-3.4.0/testing/test_pdb.py 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/testing/test_pdb.py 2018-02-20 22:04:39.000000000 +0100 @@ -141,19 +141,50 @@ child.sendeof() self.flush(child) - def test_pdb_interaction_capture(self, testdir): + def test_pdb_print_captured_stdout(self, testdir): p1 = testdir.makepyfile(""" def test_1(): - print("getrekt") + print("get\\x20rekt") assert False """) child = testdir.spawn_pytest("--pdb %s" % p1) - child.expect("getrekt") + child.expect("captured stdout") + child.expect("get rekt") child.expect("(Pdb)") child.sendeof() rest = child.read().decode("utf8") assert "1 failed" in rest - assert "getrekt" not in rest + assert "get rekt" not in rest + self.flush(child) + + def test_pdb_print_captured_stderr(self, testdir): + p1 = testdir.makepyfile(""" + def test_1(): + import sys + sys.stderr.write("get\\x20rekt") + assert False + """) + child = testdir.spawn_pytest("--pdb %s" % p1) + child.expect("captured stderr") + child.expect("get rekt") + child.expect("(Pdb)") + child.sendeof() + rest = child.read().decode("utf8") + assert "1 failed" in rest + assert "get rekt" not in rest + self.flush(child) + + def test_pdb_dont_print_empty_captured_stdout_and_stderr(self, testdir): + p1 = testdir.makepyfile(""" + def test_1(): + assert False + """) + child = testdir.spawn_pytest("--pdb %s" % p1) + child.expect("(Pdb)") + output = child.before.decode("utf8") + child.sendeof() + assert "captured stdout" not in output + assert "captured stderr" not in output self.flush(child) def test_pdb_interaction_exception(self, testdir): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-3.4.0/testing/test_recwarn.py new/pytest-3.4.1/testing/test_recwarn.py --- old/pytest-3.4.0/testing/test_recwarn.py 2018-01-30 20:51:47.000000000 +0100 +++ new/pytest-3.4.1/testing/test_recwarn.py 2018-02-20 22:04:39.000000000 +0100 @@ -206,13 +206,13 @@ with pytest.warns(RuntimeWarning): warnings.warn("user", UserWarning) excinfo.match(r"DID NOT WARN. No warnings of type \(.+RuntimeWarning.+,\) was emitted. " - r"The list of emitted warnings is: \[UserWarning\('user',\)\].") + r"The list of emitted warnings is: \[UserWarning\('user',?\)\].") with pytest.raises(pytest.fail.Exception) as excinfo: with pytest.warns(UserWarning): warnings.warn("runtime", RuntimeWarning) excinfo.match(r"DID NOT WARN. No warnings of type \(.+UserWarning.+,\) was emitted. " - r"The list of emitted warnings is: \[RuntimeWarning\('runtime',\)\].") + r"The list of emitted warnings is: \[RuntimeWarning\('runtime',?\)\].") with pytest.raises(pytest.fail.Exception) as excinfo: with pytest.warns(UserWarning):