4 new commits in pytest:

https://bitbucket.org/hpk42/pytest/commits/beb37acf4967/
Changeset:   beb37acf4967
User:        magopian
Date:        2013-08-01 11:12:02
Summary:     fixes #335: document ExceptionInfo returned by pytest.raises
Affected #:  1 file

diff -r 2d92b2270aba23d130c8e75c4f145e1e45427deb -r 
beb37acf49678f8a9c6c2dc3bb586df5f96dd173 doc/en/assert.txt
--- a/doc/en/assert.txt
+++ b/doc/en/assert.txt
@@ -78,6 +78,12 @@
 
     # do checks related to excinfo.type, excinfo.value, excinfo.traceback
 
+``excinfo`` is a `py.code.ExceptionInfo`_ instance, which is a wrapper around
+the actual exception raised.
+
+.. _py.code.ExceptionInfo:
+    http://pylib.readthedocs.org/en/latest/code.html#py-code-exceptioninfo
+
 If you want to write test code that works on Python 2.4 as well,
 you may also use two other ways to test for an expected exception::
 


https://bitbucket.org/hpk42/pytest/commits/fb9780b2d817/
Changeset:   fb9780b2d817
User:        magopian
Date:        2013-08-01 11:12:59
Summary:     Merged hpk42/pytest into default
Affected #:  2 files

diff -r beb37acf49678f8a9c6c2dc3bb586df5f96dd173 -r 
fb9780b2d8170817a14786a207addb0b6259b873 ISSUES.txt
--- a/ISSUES.txt
+++ b/ISSUES.txt
@@ -1,10 +1,4 @@
 
-improve / add to dependency/test resource injection
--------------------------------------------------------------
-tags: wish feature  docs
-
-write up better examples showing the connection between
-the two.
 
 refine parametrize API
 -------------------------------------------------------------
@@ -94,20 +88,6 @@
 record which implementations of a hook succeeded and only call their
 teardown.
 
-consider and document __init__ file usage in test directories
----------------------------------------------------------------
-tags: bug  core
-
-Currently, a test module is imported with its fully qualified
-package path, determined by checking __init__ files upwards.
-This has the side effect that a source package at the root
-of the test dir could be imported as well.  This is somewhat
-convenient but complicates the picture for running tests against
-different versions of a package.  Also, implicit sys.path
-manipulations are problematic per-se.  Maybe factorting out
-a pytest_addsyspath hook which can be disabled from the command line
-makes sense.  In any case documentation/recommendations for
-certain scenarios makes sense.
 
 relax requirement to have tests/testing contain an __init__
 ----------------------------------------------------------------
@@ -220,32 +200,10 @@
 having py.test.config and ensuretemp coming from
 a plugin rather than being there from the start.
 
-consider allowing funcargs for setup methods
---------------------------------------------------------------
-tags: experimental-wish 
-
-Users have expressed the wish to have funcargs available to setup
-functions.  Experiment with allowing funcargs there - it might
-also help to make the py.test.ensuretemp and config deprecation.
-For filling funcargs for setup methods, we could call funcarg
-factories with a request object that not have a cls/function
-attributes.  However, how to handle parametrized test functions
-and funcargs?
-
-maybe introduce a setup method like:
-
-    setup_invocation(self, request)
-
-which has full access to the test invocation through "request"
-through which you can get funcargvalues, use cached_setup etc.
-Therefore, the access to funcargs would be indirect but it
-could be consistently implemented.  setup_invocation() would
-be a "glue" function for bringing together the xUnit and funcargs
-world.
 
 consider pytest_addsyspath hook
 -----------------------------------------
-tags: 
+tags: wish
 
 py.test could call a new pytest_addsyspath() in order to systematically
 allow manipulation of sys.path and to inhibit it via --no-addsyspath
@@ -255,13 +213,6 @@
 and pytest_configure.
 
 
-show plugin information in test header
-----------------------------------------------------------------
-tags: feature 
-
-Now that external plugins are becoming more numerous
-it would be useful to have external plugins along with
-their versions displayed as a header line.
 
 deprecate global py.test.config usage
 ----------------------------------------------------------------

diff -r beb37acf49678f8a9c6c2dc3bb586df5f96dd173 -r 
fb9780b2d8170817a14786a207addb0b6259b873 testing/test_parseopt.py
--- a/testing/test_parseopt.py
+++ b/testing/test_parseopt.py
@@ -174,9 +174,9 @@
     result.stdout.fnmatch_lines(["hint: hello world", "hint: from me too"])
 
 @pytest.mark.skipif("sys.version_info < (2,5)")
-def test_argcomplete(testdir):
+def test_argcomplete(testdir, monkeypatch):
     if not py.path.local.sysfind('bash'):
-        pytest.skip("bash not available")    
+        pytest.skip("bash not available")
     import os
     script = os.path.join(os.getcwd(), 'test_argcomplete')
     with open(str(script), 'w') as fp:
@@ -185,13 +185,16 @@
         # so we use bash
         fp.write('COMP_WORDBREAKS="$COMP_WORDBREAKS" $(which py.test) '
                  '8>&1 9>&2')
-    os.environ['_ARGCOMPLETE'] = "1"
-    os.environ['_ARGCOMPLETE_IFS'] =  "\x0b"
-    os.environ['COMP_WORDBREAKS'] = ' \\t\\n"\\\'><=;|&(:'
+    # alternative would be exteneded Testdir.{run(),_run(),popen()} to be able
+    # to handle a keyword argument env that replaces os.environ in popen or
+    # extends the copy, advantage: could not forget to restore
+    monkeypatch.setenv('_ARGCOMPLETE', "1")
+    monkeypatch.setenv('_ARGCOMPLETE_IFS',"\x0b")
+    monkeypatch.setenv('COMP_WORDBREAKS', ' \\t\\n"\\\'><=;|&(:')
 
     arg = '--fu'
-    os.environ['COMP_LINE'] = "py.test " + arg
-    os.environ['COMP_POINT'] = str(len(os.environ['COMP_LINE']))
+    monkeypatch.setenv('COMP_LINE', "py.test " + arg)
+    monkeypatch.setenv('COMP_POINT', str(len("py.test " + arg)))
     result = testdir.run('bash', str(script), arg)
     print dir(result), result.ret
     if result.ret == 255:
@@ -202,7 +205,8 @@
 
     os.mkdir('test_argcomplete.d')
     arg = 'test_argc'
-    os.environ['COMP_LINE'] = "py.test " + arg
-    os.environ['COMP_POINT'] = str(len(os.environ['COMP_LINE']))
+    monkeypatch.setenv('COMP_LINE', "py.test " + arg)
+    monkeypatch.setenv('COMP_POINT', str(len('py.test ' + arg)))
     result = testdir.run('bash', str(script), arg)
     result.stdout.fnmatch_lines(["test_argcomplete", "test_argcomplete.d/"])
+    # restore environment


https://bitbucket.org/hpk42/pytest/commits/548650c26c6a/
Changeset:   548650c26c6a
User:        magopian
Date:        2013-08-01 11:19:47
Summary:     refs #335: clarify that the exception info returned by 
pytest.raises is a py.code.ExceptionInfo()
Affected #:  1 file

diff -r beb37acf49678f8a9c6c2dc3bb586df5f96dd173 -r 
548650c26c6a9cd76852d29a5c70c37fcb90075c _pytest/python.py
--- a/_pytest/python.py
+++ b/_pytest/python.py
@@ -844,6 +844,8 @@
     """ assert that a code block/function call raises @ExpectedException
     and raise a failure exception otherwise.
 
+    This helper produces a ``py.code.ExceptionInfo()`` object.
+
     If using Python 2.5 or above, you may use this function as a
     context manager::
 


https://bitbucket.org/hpk42/pytest/commits/82586cb1b93a/
Changeset:   82586cb1b93a
User:        magopian
Date:        2013-08-01 11:20:30
Summary:     merge
Affected #:  2 files

diff -r 548650c26c6a9cd76852d29a5c70c37fcb90075c -r 
82586cb1b93aeb43f2582cbf1cdf615a708287b9 ISSUES.txt
--- a/ISSUES.txt
+++ b/ISSUES.txt
@@ -1,10 +1,4 @@
 
-improve / add to dependency/test resource injection
--------------------------------------------------------------
-tags: wish feature  docs
-
-write up better examples showing the connection between
-the two.
 
 refine parametrize API
 -------------------------------------------------------------
@@ -94,20 +88,6 @@
 record which implementations of a hook succeeded and only call their
 teardown.
 
-consider and document __init__ file usage in test directories
----------------------------------------------------------------
-tags: bug  core
-
-Currently, a test module is imported with its fully qualified
-package path, determined by checking __init__ files upwards.
-This has the side effect that a source package at the root
-of the test dir could be imported as well.  This is somewhat
-convenient but complicates the picture for running tests against
-different versions of a package.  Also, implicit sys.path
-manipulations are problematic per-se.  Maybe factorting out
-a pytest_addsyspath hook which can be disabled from the command line
-makes sense.  In any case documentation/recommendations for
-certain scenarios makes sense.
 
 relax requirement to have tests/testing contain an __init__
 ----------------------------------------------------------------
@@ -220,32 +200,10 @@
 having py.test.config and ensuretemp coming from
 a plugin rather than being there from the start.
 
-consider allowing funcargs for setup methods
---------------------------------------------------------------
-tags: experimental-wish 
-
-Users have expressed the wish to have funcargs available to setup
-functions.  Experiment with allowing funcargs there - it might
-also help to make the py.test.ensuretemp and config deprecation.
-For filling funcargs for setup methods, we could call funcarg
-factories with a request object that not have a cls/function
-attributes.  However, how to handle parametrized test functions
-and funcargs?
-
-maybe introduce a setup method like:
-
-    setup_invocation(self, request)
-
-which has full access to the test invocation through "request"
-through which you can get funcargvalues, use cached_setup etc.
-Therefore, the access to funcargs would be indirect but it
-could be consistently implemented.  setup_invocation() would
-be a "glue" function for bringing together the xUnit and funcargs
-world.
 
 consider pytest_addsyspath hook
 -----------------------------------------
-tags: 
+tags: wish
 
 py.test could call a new pytest_addsyspath() in order to systematically
 allow manipulation of sys.path and to inhibit it via --no-addsyspath
@@ -255,13 +213,6 @@
 and pytest_configure.
 
 
-show plugin information in test header
-----------------------------------------------------------------
-tags: feature 
-
-Now that external plugins are becoming more numerous
-it would be useful to have external plugins along with
-their versions displayed as a header line.
 
 deprecate global py.test.config usage
 ----------------------------------------------------------------

diff -r 548650c26c6a9cd76852d29a5c70c37fcb90075c -r 
82586cb1b93aeb43f2582cbf1cdf615a708287b9 testing/test_parseopt.py
--- a/testing/test_parseopt.py
+++ b/testing/test_parseopt.py
@@ -174,9 +174,9 @@
     result.stdout.fnmatch_lines(["hint: hello world", "hint: from me too"])
 
 @pytest.mark.skipif("sys.version_info < (2,5)")
-def test_argcomplete(testdir):
+def test_argcomplete(testdir, monkeypatch):
     if not py.path.local.sysfind('bash'):
-        pytest.skip("bash not available")    
+        pytest.skip("bash not available")
     import os
     script = os.path.join(os.getcwd(), 'test_argcomplete')
     with open(str(script), 'w') as fp:
@@ -185,13 +185,16 @@
         # so we use bash
         fp.write('COMP_WORDBREAKS="$COMP_WORDBREAKS" $(which py.test) '
                  '8>&1 9>&2')
-    os.environ['_ARGCOMPLETE'] = "1"
-    os.environ['_ARGCOMPLETE_IFS'] =  "\x0b"
-    os.environ['COMP_WORDBREAKS'] = ' \\t\\n"\\\'><=;|&(:'
+    # alternative would be exteneded Testdir.{run(),_run(),popen()} to be able
+    # to handle a keyword argument env that replaces os.environ in popen or
+    # extends the copy, advantage: could not forget to restore
+    monkeypatch.setenv('_ARGCOMPLETE', "1")
+    monkeypatch.setenv('_ARGCOMPLETE_IFS',"\x0b")
+    monkeypatch.setenv('COMP_WORDBREAKS', ' \\t\\n"\\\'><=;|&(:')
 
     arg = '--fu'
-    os.environ['COMP_LINE'] = "py.test " + arg
-    os.environ['COMP_POINT'] = str(len(os.environ['COMP_LINE']))
+    monkeypatch.setenv('COMP_LINE', "py.test " + arg)
+    monkeypatch.setenv('COMP_POINT', str(len("py.test " + arg)))
     result = testdir.run('bash', str(script), arg)
     print dir(result), result.ret
     if result.ret == 255:
@@ -202,7 +205,8 @@
 
     os.mkdir('test_argcomplete.d')
     arg = 'test_argc'
-    os.environ['COMP_LINE'] = "py.test " + arg
-    os.environ['COMP_POINT'] = str(len(os.environ['COMP_LINE']))
+    monkeypatch.setenv('COMP_LINE', "py.test " + arg)
+    monkeypatch.setenv('COMP_POINT', str(len('py.test ' + arg)))
     result = testdir.run('bash', str(script), arg)
     result.stdout.fnmatch_lines(["test_argcomplete", "test_argcomplete.d/"])
+    # restore environment

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.
_______________________________________________
pytest-commit mailing list
pytest-commit@python.org
http://mail.python.org/mailman/listinfo/pytest-commit

Reply via email to