[py-svn] commit/pytest: 2 new changesets

Bitbucket commits-noreply at bitbucket.org
Wed Mar 2 18:04:39 CET 2011


2 new changesets in pytest:

http://bitbucket.org/hpk42/pytest/changeset/12f5391260d3/
changeset:   r2162:12f5391260d3
user:        hpk42
date:        2011-02-27 12:52:27
summary:     fix help string
affected #:  1 file (7 bytes)

--- a/_pytest/terminal.py	Wed Feb 16 00:32:57 2011 +0100
+++ b/_pytest/terminal.py	Sun Feb 27 12:52:27 2011 +0100
@@ -25,7 +25,7 @@
     group._addoption('--tb', metavar="style",
                action="store", dest="tbstyle", default='long',
                type="choice", choices=['long', 'short', 'no', 'line', 'native'],
-               help="traceback print mode (long/short/line/no).")
+               help="traceback print mode (long/short/line/native/no).")
     group._addoption('--fulltrace',
                action="store_true", dest="fulltrace", default=False,
                help="don't cut any tracebacks (default is to cut).")


http://bitbucket.org/hpk42/pytest/changeset/4d4d9fa7529d/
changeset:   r2163:4d4d9fa7529d
user:        hpk42
date:        2011-03-02 18:03:43
summary:     fix issue 28 - setup_method now works with pytest_generate_tests
affected #:  5 files (595 bytes)

--- a/CHANGELOG	Sun Feb 27 12:52:27 2011 +0100
+++ b/CHANGELOG	Wed Mar 02 18:03:43 2011 +0100
@@ -1,6 +1,8 @@
 Changes between 2.0.1 and 2.0.2
 ----------------------------------------------
 
+- fix issue28 - setup_method and pytest_generate_tests work together
+
 - fix issue24 - pytest_assertrepr_compare produces an in-line
   exception on python3
 


--- a/_pytest/python.py	Sun Feb 27 12:52:27 2011 +0100
+++ b/_pytest/python.py	Wed Mar 02 18:03:43 2011 +0100
@@ -297,13 +297,8 @@
 class FunctionMixin(PyobjMixin):
     """ mixin for the code common to Function and Generator.
     """
-
     def setup(self):
         """ perform setup for this test function. """
-        if inspect.ismethod(self.obj):
-            name = 'setup_method'
-        else:
-            name = 'setup_function'
         if hasattr(self, '_preservedparent'):
             obj = self._preservedparent
         elif isinstance(self.parent, Instance):
@@ -311,6 +306,10 @@
             self.obj = self._getobj()
         else:
             obj = self.parent.obj
+        if inspect.ismethod(self.obj):
+            name = 'setup_method'
+        else:
+            name = 'setup_function'
         setup_func_or_method = getattr(obj, name, None)
         if setup_func_or_method is not None:
             setup_func_or_method(self.obj)


--- a/pytest.py	Sun Feb 27 12:52:27 2011 +0100
+++ b/pytest.py	Wed Mar 02 18:03:43 2011 +0100
@@ -1,7 +1,7 @@
 """
 unit and functional testing with Python.
 """
-__version__ = '2.0.2.dev0'
+__version__ = '2.0.2.dev1'
 __all__ = ['main']
 
 from _pytest.core import main, UsageError, _preloadplugins


--- a/setup.py	Sun Feb 27 12:52:27 2011 +0100
+++ b/setup.py	Wed Mar 02 18:03:43 2011 +0100
@@ -22,7 +22,7 @@
         name='pytest',
         description='py.test: simple powerful testing with Python',
         long_description = long_description,
-        version='2.0.2.dev0',
+        version='2.0.2.dev1',
         url='http://pytest.org',
         license='MIT license',
         platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],


--- a/testing/test_python.py	Sun Feb 27 12:52:27 2011 +0100
+++ b/testing/test_python.py	Wed Mar 02 18:03:43 2011 +0100
@@ -1062,6 +1062,21 @@
             "*2 pass*",
         ])
 
+    def test_issue28_setup_method_in_generate_tests(self, testdir):
+        p = testdir.makepyfile("""
+            def pytest_generate_tests(metafunc):
+                metafunc.addcall({'arg1': 1})
+
+            class TestClass:
+                def test_method(self, arg1):
+                    assert arg1 == self.val
+                def setup_method(self, func):
+                    self.val = 1
+            """)
+        result = testdir.runpytest(p)
+        result.stdout.fnmatch_lines([
+            "*1 pass*",
+        ])
 
 def test_conftest_funcargs_only_available_in_subdir(testdir):
     sub1 = testdir.mkpydir("sub1")

Repository URL: https://bitbucket.org/hpk42/pytest/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the pytest-commit mailing list