Skip to content

Features merge master #1234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 47 commits into from
Closed

Conversation

bukzor
Copy link

@bukzor bukzor commented Dec 7, 2015

I'd like to directly use the current features branch in my project in order to validate my contribution, but the fix for #1100 hasn't been merged in.

In this branch, I've merged the bug fixes in master back to the features branch, so that it's usable.
Since github doesn't display merge commits very well, below I show what exactly I had to do during merge conflict resolution:

commit eabf2f909100741f63ce69884c186ab20410ceb3
Merge: 84eacf3 ffa5725
Author: Buck Golemon <[email protected]>
Date:   Mon Dec 7 14:27:41 2015 -0800

    Merge branch 'master' into features

    Conflicts:
        AUTHORS
        _pytest/__init__.py
        _pytest/hookspec.py
        _pytest/recwarn.py
        testing/test_recwarn.py

diff --cc AUTHORS
index 8f348e0,641e204..b943914
--- a/AUTHORS
+++ b/AUTHORS
@@@ -52,7 -53,7 +54,8 @@@ Marc Schlaic
  Mark Abramowitz
  Markus Unterwaditzer
  Martijn Faassen
 +Michael Aquilina
+ Michael Birtwell
  Michael Droettboom
  Nicolas Delaby
  Pieter Mulder
diff --cc CHANGELOG
index 37a23dd,49d5a87..d504e7a
--- a/CHANGELOG
+++ b/CHANGELOG
@@@ -1,19 -1,83 +1,96 @@@
 +2.9.0.dev
 +---------
 +
 +* New `pytest.mark.skip` mark, which unconditional skips marked tests.
 +  Thanks Michael Aquilina for the complete PR.
 +
 +* fix issue #680: the -s and -c options should now work under xdist;
 +  `Config.fromdictargs` now represents its input much more faithfully.
 +  Thanks to Buck Evan for the complete PR.
 +
 +* `pytest_enter_pdb` now optionally receives the pytest config object.
 +  Thanks Bruno Oliveira for the PR.
 +
- 2.8.2.dev
- ---------
+ 2.8.5.dev0
+ ----------
+ 
+ - fix #1074: precompute junitxml chunks instead of storing the whole tree in objects
+   Thanks Bruno Oliveira for the report and Ronny Pfannschmidt for the PR
+ 
+ 
+ 2.8.4
+ -----
+ 
+ - fix #1190: ``deprecated_call()`` now works when the deprecated
+   function has been already called by another test in the same
+   module. Thanks Mikhail Chernykh for the report and Bruno Oliveira for the
+   PR.
+ 
+ - fix #1198: ``--pastebin`` option now works on Python 3. Thanks
+   Mehdy Khoshnoody for the PR.
+ 
+ - fix #1219: ``--pastebin`` now works correctly when captured output contains
+   non-ascii characters. Thanks Bruno Oliveira for the PR.
+ 
+ - fix #1204: another error when collecting with a nasty __getattr__().
+   Thanks Florian Bruhin for the PR.
+ 
+ - fix the summary printed when no tests did run.
+   Thanks Florian Bruhin for the PR.
+ - fix #1185 - ensure MANIFEST.in exactly matches what should go to a sdist
+ 
+ - a number of documentation modernizations wrt good practices.
+   Thanks Bruno Oliveira for the PR.
+ 
+ 2.8.3
+ -----
+ 
+ - fix #1169: add __name__ attribute to testcases in TestCaseFunction to
+   support the @unittest.skip decorator on functions and methods.
+   Thanks Lee Kamentsky for the PR.
+ 
+ - fix #1035: collecting tests if test module level obj has __getattr__().
+   Thanks Suor for the report and Bruno Oliveira / Tom Viner for the PR.
+ 
+ - fix #331: don't collect tests if their failure cannot be reported correctly
+   e.g. they are a callable instance of a class.
+ 
+ - fix #1133: fixed internal error when filtering tracebacks where one entry
+   belongs to a file which is no longer available.
+   Thanks Bruno Oliveira for the PR.
+ 
+ - enhancement made to highlight in red the name of the failing tests so
+   they stand out in the output.
+   Thanks Gabriel Reis for the PR.
+ 
+ - add more talks to the documentation
+ - extend documentation on the --ignore cli option 
+ - use pytest-runner for setuptools integration 
+ - minor fixes for interaction with OS X El Capitan
+   system integrity protection (thanks Florian)
+ 
+ 
+ 
+ 
+ 2.8.2
+ -----
+ 
+ - fix #1085: proper handling of encoding errors when passing encoded byte
+   strings to pytest.parametrize in Python 2.
+   Thanks Themanwithoutaplan for the report and Bruno Oliveira for the PR.
+ 
+ - fix #1087: handling SystemError when passing empty byte strings to
+   pytest.parametrize in Python 3.
+   Thanks Paul Kehrer for the report and Bruno Oliveira for the PR.
+ 
+ - fix #995: fixed internal error when filtering tracebacks where one entry
+   was generated by an exec() statement.
+   Thanks Daniel Hahler, Ashley C Straw, Philippe Gauthier and Pavel Savchenko
+   for contributing and Bruno Oliveira for the PR.

+ - fix #1100 and #1057: errors when using autouse fixtures and doctest modules.
+   Thanks Sergey B Kirpichev and Vital Kudzelka for contributing and Bruno
+   Oliveira for the PR.

  2.8.1
  -----
diff --cc _pytest/recwarn.py
index 2922e5b,c4f9dc3..dd7164e
--- a/_pytest/recwarn.py
+++ b/_pytest/recwarn.py
@@@ -28,27 -28,40 +28,48 @@@ def pytest_namespace()
              'warns': warns}


 -def deprecated_call(func, *args, **kwargs):
 +def deprecated_call(func=None, *args, **kwargs):
-     """Assert that ``func(*args, **kwargs)`` triggers a DeprecationWarning.
+     """ assert that calling ``func(*args, **kwargs)`` triggers a
+     ``DeprecationWarning`` or ``PendingDeprecationWarning``.

 +    This function can be used as a context manager::
 +
 +        >>> with deprecated_call():
 +        ...    myobject.deprecated_method()
++
+     Note: we cannot use WarningsRecorder here because it is still subject
+     to the mechanism that prevents warnings of the same type from being
+     triggered twice for the same module. See #1190.
      """
 +    if not func:
 +        return WarningsChecker(expected_warning=DeprecationWarning)
 +
-     wrec = WarningsRecorder()
-     with wrec:
-         warnings.simplefilter('always')  # ensure all warnings are triggered
-         ret = func(*args, **kwargs)
+     categories = []

-     depwarnings = (DeprecationWarning, PendingDeprecationWarning)
-     if not any(r.category in depwarnings for r in wrec):
+     def warn_explicit(message, category, *args, **kwargs):
+         categories.append(category)
+         old_warn_explicit(message, category, *args, **kwargs)
+ 
+     def warn(message, category=None, **kwargs):
+         if isinstance(message, Warning):
+             categories.append(message.__class__)
+         else:
+             categories.append(category)
+         old_warn(message, category, *args, **kwargs)
+ 
+     old_warn = warnings.warn
+     old_warn_explicit = warnings.warn_explicit
+     warnings.warn_explicit = warn_explicit
+     warnings.warn = warn
+     try:
+         ret = func(*args, **kwargs)
+     finally:
+         warnings.warn_explicit = old_warn_explicit
+         warnings.warn = old_warn
+     deprecation_categories = (DeprecationWarning, PendingDeprecationWarning)
+     if not any(issubclass(c, deprecation_categories) for c in categories):
          __tracebackhide__ = True
          raise AssertionError("%r did not produce DeprecationWarning" % (func,))
- 
      return ret


diff --cc doc/en/skipping.rst
index 25e3c81,f1f641c..216a34c
--- a/doc/en/skipping.rst
+++ b/doc/en/skipping.rst
@@@ -175,10 -165,10 +175,10 @@@ Running it with the report-on-xfail opt

      example $ py.test -rx xfail_demo.py
      ======= test session starts ========
-     platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1
+     platform linux -- Python 3.4.3, pytest-2.8.4, py-1.4.30, pluggy-0.3.1
      rootdir: $REGENDOC_TMPDIR/example, inifile: 
      collected 7 items
 -    
 +
      xfail_demo.py xxxxxxx
      ======= short test summary info ========
      XFAIL xfail_demo.py::test_hello
diff --cc testing/test_recwarn.py
index 97a0f25,c426ea8..d8b8bbc
--- a/testing/test_recwarn.py
+++ b/testing/test_recwarn.py
@@@ -105,25 -102,16 +102,26 @@@ class TestDeprecatedCall(object)
          assert warn_explicit is py.std.warnings.warn_explicit

      def test_deprecated_explicit_call_raises(self):
-         pytest.raises(AssertionError,
-                       "pytest.deprecated_call(dep_explicit, 3)")
+         with pytest.raises(AssertionError):
+             pytest.deprecated_call(self.dep_explicit, 3)

      def test_deprecated_explicit_call(self):
-         pytest.deprecated_call(dep_explicit, 0)
-         pytest.deprecated_call(dep_explicit, 0)
+         pytest.deprecated_call(self.dep_explicit, 0)
+         pytest.deprecated_call(self.dep_explicit, 0)

 +    def test_deprecated_call_as_context_manager_no_warning(self):
 +        with pytest.raises(pytest.fail.Exception) as ex:
 +            with pytest.deprecated_call():
 +                dep(1)
 +        assert str(ex.value) == "DID NOT WARN"
 +
 +    def test_deprecated_call_as_context_manager(self):
 +        with pytest.deprecated_call():
 +            dep(0)
 +
      def test_deprecated_call_pending(self):
-         f = lambda: py.std.warnings.warn(PendingDeprecationWarning("hi"))
+         def f():
+             py.std.warnings.warn(PendingDeprecationWarning("hi"))
          pytest.deprecated_call(f)

      def test_deprecated_call_specificity(self):

chiller and others added 30 commits September 21, 2015 19:01
Conflicts:
	_pytest/__init__.py
Conflicts:
	_pytest/__init__.py
	testing/test_recwarn.py
@RonnyPfannschmidt
Copy link
Member

unfortunately the pull request is against the wrong branch and we cant merge it using github that way, please reopen the request against the features branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants