From 5d0fd33b64f983cd401f541142f49f0c2f24bd2c Mon Sep 17 00:00:00 2001 From: holger krekel Date: Tue, 23 Jun 2009 12:19:55 +0200 Subject: [PATCH 01/15] bumping version to "1.0.x" for now, regen setup, opening 1.0.x branch --HG-- branch : 1.0.x --- MANIFEST | 386 ------------------------------------------------- py/__init__.py | 2 +- setup.py | 104 +------------ 3 files changed, 8 insertions(+), 484 deletions(-) diff --git a/MANIFEST b/MANIFEST index fd52490e9..e69de29bb 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,386 +0,0 @@ -.hgignore -CHANGELOG -LICENSE -MANIFEST -README.txt -TODO.txt -_findpy.py -doc/announce/release-0.9.0.txt -doc/announce/release-0.9.2.txt -doc/announce/release-1.0.0.txt -doc/announce/releases.txt -doc/bin.txt -doc/code.txt -doc/confrest.py -doc/conftest.py -doc/contact.txt -doc/download.txt -doc/execnet.txt -doc/img/pylib.png -doc/index.txt -doc/io.txt -doc/log.txt -doc/misc.txt -doc/path.txt -doc/style.css -doc/test/attic.txt -doc/test/config.txt -doc/test/dist.txt -doc/test/examples.txt -doc/test/extend.txt -doc/test/features.txt -doc/test/funcargs.txt -doc/test/quickstart.txt -doc/test/test.txt -doc/test/xunit_setup.txt -doc/xml.txt -example/execnet/popen_read_multiple.py -example/funcarg/costlysetup/conftest.py -example/funcarg/costlysetup/sub1/test_quick.py -example/funcarg/costlysetup/sub2/test_two.py -example/funcarg/mysetup/__init__.py -example/funcarg/mysetup/conftest.py -example/funcarg/mysetup/myapp.py -example/funcarg/mysetup/test_sample.py -example/funcarg/mysetup2/__init__.py -example/funcarg/mysetup2/conftest.py -example/funcarg/mysetup2/myapp.py -example/funcarg/mysetup2/test_sample.py -example/funcarg/mysetup2/test_ssh.py -example/funcarg/parametrize/test_parametrize.py -example/funcarg/parametrize/test_parametrize2.py -example/funcarg/parametrize/test_parametrize3.py -example/funcarg/test_simpleprovider.py -example/genhtml.py -example/genhtmlcss.py -example/genxml.py -example/pytest/failure_demo.py -example/pytest/test_failures.py -example/pytest/test_setup_flow_example.py -ez_setup.py -py/LICENSE -py/__init__.py -py/_com.py -py/bin/_findpy.py -py/bin/_genscripts.py -py/bin/gendoc.py -py/bin/py.cleanup -py/bin/py.countloc -py/bin/py.lookup -py/bin/py.rest -py/bin/py.svnwcrevert -py/bin/py.test -py/bin/py.which -py/bin/win32/py.cleanup.cmd -py/bin/win32/py.countloc.cmd -py/bin/win32/py.lookup.cmd -py/bin/win32/py.rest.cmd -py/bin/win32/py.svnwcrevert.cmd -py/bin/win32/py.test.cmd -py/bin/win32/py.which.cmd -py/builtin/__init__.py -py/builtin/enumerate.py -py/builtin/exception.py -py/builtin/reversed.py -py/builtin/set.py -py/builtin/sorted.py -py/builtin/testing/__init__.py -py/builtin/testing/test_enumerate.py -py/builtin/testing/test_exception.py -py/builtin/testing/test_reversed.py -py/builtin/testing/test_set.py -py/builtin/testing/test_sorted.py -py/cmdline/__init__.py -py/cmdline/pycleanup.py -py/cmdline/pycountloc.py -py/cmdline/pylookup.py -py/cmdline/pyrest.py -py/cmdline/pysvnwcrevert.py -py/cmdline/pytest.py -py/cmdline/pywhich.py -py/cmdline/testing/__init__.py -py/cmdline/testing/test_cmdline.py -py/cmdline/testing/test_generic.py -py/code/__init__.py -py/code/code.py -py/code/excinfo.py -py/code/frame.py -py/code/safe_repr.py -py/code/source.py -py/code/testing/__init__.py -py/code/testing/test_code.py -py/code/testing/test_excinfo.py -py/code/testing/test_frame.py -py/code/testing/test_safe_repr.py -py/code/testing/test_source.py -py/code/traceback2.py -py/compat/LICENSE -py/compat/__init__.py -py/compat/conftest.py -py/compat/doctest.py -py/compat/optparse.py -py/compat/subprocess.py -py/compat/testing/__init__.py -py/compat/testing/test_doctest.py -py/compat/testing/test_doctest.txt -py/compat/testing/test_doctest2.py -py/compat/testing/test_doctest2.txt -py/compat/testing/test_optparse.py -py/compat/testing/test_subprocess.py -py/compat/testing/test_textwrap.py -py/compat/textwrap.py -py/conftest.py -py/env.cmd -py/env.py -py/execnet/NOTES -py/execnet/__init__.py -py/execnet/channel.py -py/execnet/gateway.py -py/execnet/gwmanage.py -py/execnet/improve-remote-tracebacks.txt -py/execnet/inputoutput.py -py/execnet/message.py -py/execnet/multi.py -py/execnet/register.py -py/execnet/rsync.py -py/execnet/rsync_remote.py -py/execnet/script/__init__.py -py/execnet/script/loop_socketserver.py -py/execnet/script/quitserver.py -py/execnet/script/shell.py -py/execnet/script/socketserver.py -py/execnet/script/socketserverservice.py -py/execnet/script/xx.py -py/execnet/testing/__init__.py -py/execnet/testing/conftest.py -py/execnet/testing/test_event.py -py/execnet/testing/test_gateway.py -py/execnet/testing/test_gwmanage.py -py/execnet/testing/test_multi.py -py/execnet/testing/test_pickle.py -py/execnet/testing/test_rsync.py -py/execnet/testing/test_xspec.py -py/execnet/xspec.py -py/initpkg.py -py/io/__init__.py -py/io/dupfile.py -py/io/fdcapture.py -py/io/stdcapture.py -py/io/terminalwriter.py -py/io/testing/__init__.py -py/io/testing/test_dupfile.py -py/io/testing/test_fdcapture.py -py/io/testing/test_stdcapture.py -py/io/testing/test_terminalwriter.py -py/log/__init__.py -py/log/consumer.py -py/log/logger.py -py/log/producer.py -py/log/testing/__init__.py -py/log/testing/test_log.py -py/log/testing/test_logger.py -py/log/testing/test_warning.py -py/log/warning.py -py/magic/__init__.py -py/magic/assertion.py -py/magic/autopath.py -py/magic/exprinfo.py -py/magic/invoke.py -py/magic/patch.py -py/magic/testing/__init__.py -py/magic/testing/test_assertion.py -py/magic/testing/test_autopath.py -py/magic/testing/test_exprinfo.py -py/magic/testing/test_invoke.py -py/magic/testing/test_patch.py -py/magic/testing/test_viewtype.py -py/magic/viewtype.py -py/misc/__init__.py -py/misc/_dist.py -py/misc/buildcmodule.py -py/misc/cache.py -py/misc/cmdline/__init__.py -py/misc/cmdline/countloc.py -py/misc/difftime.py -py/misc/dynpkg.py -py/misc/error.py -py/misc/findmissingdocstrings.py -py/misc/rest.py -py/misc/std.py -py/misc/svnlook.py -py/misc/terminal_helper.py -py/misc/testing/__init__.py -py/misc/testing/data/svnlookrepo.dump -py/misc/testing/test_api.py -py/misc/testing/test_cache.py -py/misc/testing/test_com.py -py/misc/testing/test_error.py -py/misc/testing/test_initpkg.py -py/misc/testing/test_std.py -py/misc/testing/test_svnlook.py -py/misc/testing/test_terminal.py -py/path/__init__.py -py/path/common.py -py/path/gateway/TODO.txt -py/path/gateway/__init__.py -py/path/gateway/channeltest.py -py/path/gateway/channeltest2.py -py/path/gateway/remotepath.py -py/path/local/__init__.py -py/path/local/common.py -py/path/local/local.py -py/path/local/posix.py -py/path/local/testing/__init__.py -py/path/local/testing/test_local.py -py/path/local/testing/test_posix.py -py/path/local/testing/test_win.py -py/path/local/win.py -py/path/svn/__init__.py -py/path/svn/cache.py -py/path/svn/quoting.txt -py/path/svn/svncommon.py -py/path/svn/testing/__init__.py -py/path/svn/testing/repotest.dump -py/path/svn/testing/svntestbase.py -py/path/svn/testing/test_auth.py -py/path/svn/testing/test_test_repo.py -py/path/svn/testing/test_urlcommand.py -py/path/svn/testing/test_wccommand.py -py/path/svn/urlcommand.py -py/path/svn/wccommand.py -py/path/testing/__init__.py -py/path/testing/common.py -py/path/testing/fscommon.py -py/path/testing/test_api.py -py/process/__init__.py -py/process/cmdexec.py -py/process/forkedfunc.py -py/process/killproc.py -py/process/testing/__init__.py -py/process/testing/test_cmdexec.py -py/process/testing/test_forkedfunc.py -py/process/testing/test_killproc.py -py/rest/__init__.py -py/rest/convert.py -py/rest/directive.py -py/rest/latex.py -py/rest/rest.sty.template -py/rest/rst.py -py/rest/testing/__init__.py -py/rest/testing/data/example.rst2pdfconfig -py/rest/testing/data/example1.dot -py/rest/testing/data/formula.txt -py/rest/testing/data/formula1.txt -py/rest/testing/data/graphviz.txt -py/rest/testing/data/part1.txt -py/rest/testing/data/part2.txt -py/rest/testing/data/tocdepth.rst2pdfconfig -py/rest/testing/setup.py -py/rest/testing/test_convert.py -py/rest/testing/test_directive.py -py/rest/testing/test_htmlrest.py -py/rest/testing/test_rst.py -py/rest/testing/test_rst2pdf.py -py/rest/testing/test_transform.py -py/rest/transform.py -py/test/__init__.py -py/test/cmdline.py -py/test/collect.py -py/test/compat.py -py/test/config.py -py/test/conftesthandle.py -py/test/defaultconftest.py -py/test/dist/__init__.py -py/test/dist/dsession.py -py/test/dist/mypickle.py -py/test/dist/nodemanage.py -py/test/dist/testing/__init__.py -py/test/dist/testing/test_dsession.py -py/test/dist/testing/test_mypickle.py -py/test/dist/testing/test_nodemanage.py -py/test/dist/testing/test_txnode.py -py/test/dist/txnode.py -py/test/funcargs.py -py/test/looponfail/__init__.py -py/test/looponfail/remote.py -py/test/looponfail/testing/__init__.py -py/test/looponfail/testing/test_remote.py -py/test/looponfail/testing/test_util.py -py/test/looponfail/util.py -py/test/outcome.py -py/test/parseopt.py -py/test/plugin/__init__.py -py/test/plugin/conftest.py -py/test/plugin/hookspec.py -py/test/plugin/pytest__pytest.py -py/test/plugin/pytest_default.py -py/test/plugin/pytest_doctest.py -py/test/plugin/pytest_execnetcleanup.py -py/test/plugin/pytest_figleaf.py -py/test/plugin/pytest_hooklog.py -py/test/plugin/pytest_iocapture.py -py/test/plugin/pytest_monkeypatch.py -py/test/plugin/pytest_pdb.py -py/test/plugin/pytest_pocoo.py -py/test/plugin/pytest_pylint.py -py/test/plugin/pytest_pytester.py -py/test/plugin/pytest_recwarn.py -py/test/plugin/pytest_restdoc.py -py/test/plugin/pytest_resultdb.py -py/test/plugin/pytest_resultlog.py -py/test/plugin/pytest_runner.py -py/test/plugin/pytest_terminal.py -py/test/plugin/pytest_tmpdir.py -py/test/plugin/pytest_unittest.py -py/test/plugin/pytest_xfail.py -py/test/plugin/test_pytest_runner.py -py/test/pluginmanager.py -py/test/pycollect.py -py/test/session.py -py/test/testing/__init__.py -py/test/testing/acceptance_test.py -py/test/testing/conftest.py -py/test/testing/import_test/package/__init__.py -py/test/testing/import_test/package/absolute_import_shared_lib.py -py/test/testing/import_test/package/module_that_imports_shared_lib.py -py/test/testing/import_test/package/shared_lib.py -py/test/testing/import_test/package/test_import.py -py/test/testing/test_collect.py -py/test/testing/test_compat.py -py/test/testing/test_config.py -py/test/testing/test_conftesthandle.py -py/test/testing/test_deprecated_api.py -py/test/testing/test_funcargs.py -py/test/testing/test_genitems.py -py/test/testing/test_outcome.py -py/test/testing/test_parseopt.py -py/test/testing/test_pickling.py -py/test/testing/test_pluginmanager.py -py/test/testing/test_pycollect.py -py/test/testing/test_recording.py -py/test/testing/test_session.py -py/test/testing/test_setup_functional.py -py/test/testing/test_traceback.py -py/test/web/__init__.py -py/test/web/exception.py -py/test/web/post_multipart.py -py/test/web/webcheck.py -py/thread/__init__.py -py/thread/io.py -py/thread/pool.py -py/thread/testing/__init__.py -py/thread/testing/test_io.py -py/thread/testing/test_pool.py -py/tool/__init__.py -py/tool/testing/__init__.py -py/tool/testing/test_utestconvert.py -py/tool/utestconvert.py -py/xmlobj/__init__.py -py/xmlobj/html.py -py/xmlobj/misc.py -py/xmlobj/testing/__init__.py -py/xmlobj/testing/test_html.py -py/xmlobj/testing/test_xml.py -py/xmlobj/visit.py -py/xmlobj/xml.py -setup.py \ No newline at end of file diff --git a/py/__init__.py b/py/__init__.py index 2188708ed..97bebde57 100644 --- a/py/__init__.py +++ b/py/__init__.py @@ -19,7 +19,7 @@ For questions please check out http://pylib.org/contact.html """ from initpkg import initpkg -version = "1.0.0b3" +version = "1.0.x" initpkg(__name__, description = "py.test and pylib: advanced testing tool and networking lib", diff --git a/setup.py b/setup.py index 69e618d4b..ed77c5b18 100644 --- a/setup.py +++ b/setup.py @@ -2,12 +2,12 @@ autogenerated by gensetup.py setup file for 'py' package based on: -changeset: 1164:506f4c5f741b +changeset: 1165:0516498708b6 branch: trunk tag: tip user: holger krekel -date: Tue Jun 23 11:33:20 2009 +0200 -summary: Added tag 1.0.0b3 for changeset 52c6d9e78777 +date: Tue Jun 23 12:12:45 2009 +0200 +summary: remove TODO file (mostly done, superflous or in the issue tracker), """ @@ -41,20 +41,14 @@ def main(): name='py', description='py.test and pylib: advanced testing tool and networking lib', long_description = long_description, - version='1.0.0b3', + version='1.0.x', url='http://pylib.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], author='holger krekel, Guido Wesdorp, Carl Friedrich Bolz, Armin Rigo, Maciej Fijalkowski & others', author_email='holger at merlinux.eu, py-dev at codespeak.net', - entry_points={'console_scripts': ['py.cleanup = py.cmdline:pycleanup', - 'py.countloc = py.cmdline:pycountloc', - 'py.lookup = py.cmdline:pylookup', - 'py.rest = py.cmdline:pyrest', - 'py.svnwcrevert = py.cmdline:pysvnwcrevert', - 'py.test = py.cmdline:pytest', - 'py.which = py.cmdline:pywhich']}, + entry_points={'console_scripts': []}, classifiers=['Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', @@ -66,92 +60,8 @@ def main(): 'Topic :: System :: Distributed Computing', 'Topic :: Utilities', 'Programming Language :: Python'], - packages=['example.funcarg.mysetup', - 'example.funcarg.mysetup2', - 'py', - 'py.builtin', - 'py.builtin.testing', - 'py.cmdline', - 'py.cmdline.testing', - 'py.code', - 'py.code.testing', - 'py.compat', - 'py.compat.testing', - 'py.execnet', - 'py.execnet.script', - 'py.execnet.testing', - 'py.io', - 'py.io.testing', - 'py.log', - 'py.log.testing', - 'py.magic', - 'py.magic.testing', - 'py.misc', - 'py.misc.cmdline', - 'py.misc.testing', - 'py.path', - 'py.path.gateway', - 'py.path.local', - 'py.path.local.testing', - 'py.path.svn', - 'py.path.svn.testing', - 'py.path.testing', - 'py.process', - 'py.process.testing', - 'py.rest', - 'py.rest.testing', - 'py.test', - 'py.test.dist', - 'py.test.dist.testing', - 'py.test.looponfail', - 'py.test.looponfail.testing', - 'py.test.plugin', - 'py.test.testing', - 'py.test.testing.import_test.package', - 'py.test.web', - 'py.thread', - 'py.thread.testing', - 'py.tool', - 'py.tool.testing', - 'py.xmlobj', - 'py.xmlobj.testing'], - package_data={'py': ['LICENSE', - 'bin/_findpy.py', - 'bin/_genscripts.py', - 'bin/gendoc.py', - 'bin/py.cleanup', - 'bin/py.countloc', - 'bin/py.lookup', - 'bin/py.rest', - 'bin/py.svnwcrevert', - 'bin/py.test', - 'bin/py.which', - 'bin/win32/py.cleanup.cmd', - 'bin/win32/py.countloc.cmd', - 'bin/win32/py.lookup.cmd', - 'bin/win32/py.rest.cmd', - 'bin/win32/py.svnwcrevert.cmd', - 'bin/win32/py.test.cmd', - 'bin/win32/py.which.cmd', - 'compat/LICENSE', - 'compat/testing/test_doctest.txt', - 'compat/testing/test_doctest2.txt', - 'env.cmd', - 'execnet/NOTES', - 'execnet/improve-remote-tracebacks.txt', - 'misc/testing/data/svnlookrepo.dump', - 'path/gateway/TODO.txt', - 'path/svn/quoting.txt', - 'path/svn/testing/repotest.dump', - 'rest/rest.sty.template', - 'rest/testing/data/example.rst2pdfconfig', - 'rest/testing/data/example1.dot', - 'rest/testing/data/formula.txt', - 'rest/testing/data/formula1.txt', - 'rest/testing/data/graphviz.txt', - 'rest/testing/data/part1.txt', - 'rest/testing/data/part2.txt', - 'rest/testing/data/tocdepth.rst2pdfconfig']}, + packages=[], + package_data={'py': []}, zip_safe=False, ) From 4ab0f25b050cc6d29e2f68704a88e06ba61ea5aa Mon Sep 17 00:00:00 2001 From: holger krekel Date: Tue, 23 Jun 2009 17:10:52 +0200 Subject: [PATCH 02/15] remove scope argument from request.addfinalizer --HG-- branch : 1.0.x --- CHANGELOG | 5 ++++ doc/test/funcargs.txt | 46 +++++++++++++++----------------- py/test/funcargs.py | 8 ++++-- py/test/testing/test_funcargs.py | 20 +++----------- 4 files changed, 35 insertions(+), 44 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 9982545f1..c77c95d41 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +Changes between 1.0.0b3 and 1.0.0 +============================================= + +* remove scope-argument from request.addfinalizer() because + request.cached_setup has the scope arg. TOOWTDI. Changes between 1.0.0b1 and 1.0.0b3 ============================================= diff --git a/doc/test/funcargs.txt b/doc/test/funcargs.txt index b4b915eb4..45cdb137b 100644 --- a/doc/test/funcargs.txt +++ b/doc/test/funcargs.txt @@ -120,7 +120,27 @@ to access test configuration and test context: ``request.param``: if exists was passed by a `parametrizing test generator`_ -perform scoped setup and teardown +teardown/cleanup after test function execution +------------------------------------------------ + +.. sourcecode:: python + + def addfinalizer(func): + """ call a finalizer function when test function finishes. """ + +Calling ``request.addfinalizer()`` is useful for scheduling teardown +functions. Here is an example for providing a ``myfile`` +object that is to be closed when the test function finishes. + +.. sourcecode:: python + + def pytest_funcarg__myfile(self, request): + # ... create and open a unique per-function "myfile" object ... + request.addfinalizer(lambda: myfile.close()) + return myfile + + +perform scope-specific setup and cleanup --------------------------------------------- .. sourcecode:: python @@ -148,30 +168,6 @@ example for providing a value that is to be setup only once during a test run: ) -cleanup after test function execution ---------------------------------------------- - -.. sourcecode:: python - - def addfinalizer(func, scope="function"): - """ register calling a a finalizer function. - scope == 'function': when the single test function run finishes. - scope == 'module': when tests in a different module are run - scope == 'session': when tests of the session have run. - """ - -Calling ``request.addfinalizer()`` is useful for scheduling teardown -functions. The given scope determines when the teardown function -will be called. Here is a basic example for providing a ``myfile`` -object that is to be closed when the test function finishes. - -.. sourcecode:: python - - def pytest_funcarg__myfile(self, request): - # ... create and open a unique per-function "myfile" object ... - request.addfinalizer(lambda: myfile.close()) - return myfile - requesting values of other funcargs --------------------------------------------- diff --git a/py/test/funcargs.py b/py/test/funcargs.py index ec30c353e..74f36a054 100644 --- a/py/test/funcargs.py +++ b/py/test/funcargs.py @@ -113,7 +113,7 @@ class FuncargRequest: val = setup() cache[cachekey] = val if teardown is not None: - self.addfinalizer(lambda: teardown(val), scope=scope) + self._addfinalizer(lambda: teardown(val), scope=scope) return val def getfuncargvalue(self, argname): @@ -142,10 +142,14 @@ class FuncargRequest: return None raise ValueError("unknown finalization scope %r" %(scope,)) - def addfinalizer(self, finalizer, scope="function"): + def _addfinalizer(self, finalizer, scope): colitem = self._getscopeitem(scope) self.config._setupstate.addfinalizer(finalizer=finalizer, colitem=colitem) + def addfinalizer(self, finalizer): + """ call the given finalizer after test function finished execution. """ + self._addfinalizer(finalizer, scope="function") + def __repr__(self): return "" %(self._pyfuncitem) diff --git a/py/test/testing/test_funcargs.py b/py/test/testing/test_funcargs.py index 1b4b4ea86..4f981c40c 100644 --- a/py/test/testing/test_funcargs.py +++ b/py/test/testing/test_funcargs.py @@ -163,15 +163,11 @@ class TestRequest: req._fillfuncargs() assert item.funcargs == {'something': 1} - def test_request_addfinalizer_scopes(self, testdir): + def test_request_addfinalizer(self, testdir): item = testdir.getitem(""" teardownlist = [] def pytest_funcarg__something(request): - for scope in ("function", "module", "session"): - request.addfinalizer( - lambda x=scope: teardownlist.append(x), - scope=scope) - + request.addfinalizer(lambda: teardownlist.append(1)) def test_func(something): pass """) req = funcargs.FuncargRequest(item) @@ -183,16 +179,7 @@ class TestRequest: assert not teardownlist ss.teardown_exact(item) print ss.stack - assert teardownlist == ['function'] - ss.teardown_exact(item.parent) - assert teardownlist == ['function', 'module'] - ss.teardown_all() - assert teardownlist == ['function', 'module', 'session'] - - def test_request_addfinalizer_unknown_scope(self, testdir): - item = testdir.getitem("def test_func(): pass") - req = funcargs.FuncargRequest(item) - py.test.raises(ValueError, "req.addfinalizer(None, scope='xyz')") + assert teardownlist == [1] def test_request_getmodulepath(self, testdir): modcol = testdir.getmodulecol("def test_somefunc(): pass") @@ -200,7 +187,6 @@ class TestRequest: req = funcargs.FuncargRequest(item) assert req.fspath == modcol.fspath - class TestRequestCachedSetup: def test_request_cachedsetup(self, testdir): item1,item2 = testdir.getitems(""" From 7602096f81ca7a8b4359a7dde20f6f018b9fce5c Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 24 Jun 2009 15:43:37 +0200 Subject: [PATCH 03/15] perform state setup finalization earlier --HG-- branch : 1.0.x --- CHANGELOG | 2 ++ py/test/plugin/pytest_runner.py | 7 +++++-- py/test/plugin/pytest_terminal.py | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c77c95d41..82b6d7f48 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,8 @@ Changes between 1.0.0b3 and 1.0.0 * remove scope-argument from request.addfinalizer() because request.cached_setup has the scope arg. TOOWTDI. +* perform setup finalization before reporting failures + Changes between 1.0.0b1 and 1.0.0b3 ============================================= diff --git a/py/test/plugin/pytest_runner.py b/py/test/plugin/pytest_runner.py index 62404084a..151881567 100644 --- a/py/test/plugin/pytest_runner.py +++ b/py/test/plugin/pytest_runner.py @@ -19,11 +19,14 @@ def pytest_addoption(parser): action="store_true", dest="boxed", default=False, help="box each test run in a separate process") +# XXX move to pytest_sessionstart and fix py.test owns tests def pytest_configure(config): config._setupstate = SetupState() -def pytest_unconfigure(config): - config._setupstate.teardown_all() +def pytest_sessionfinish(session, exitstatus, excrepr=None): + # XXX see above + if hasattr(session.config, '_setupstate'): + session.config._setupstate.teardown_all() def pytest_make_collect_report(collector): call = collector.config.guardedcall( diff --git a/py/test/plugin/pytest_terminal.py b/py/test/plugin/pytest_terminal.py index 1098b3095..491c500a3 100644 --- a/py/test/plugin/pytest_terminal.py +++ b/py/test/plugin/pytest_terminal.py @@ -227,7 +227,8 @@ class TerminalReporter: for i, testarg in py.builtin.enumerate(self.config.args): self.write_line("test object %d: %s" %(i+1, testarg)) - def pytest_sessionfinish(self, session, exitstatus, excrepr=None): + def pytest_sessionfinish(self, __call__, session, exitstatus, excrepr=None): + __call__.execute() self._tw.line("") if exitstatus in (0, 1, 2): self.summary_failures() From f531a1d6c99036f4f5721468f2ddaaaaa5d0ad8a Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 24 Jun 2009 15:55:57 +0200 Subject: [PATCH 04/15] addresses issue #22 allow test functions to have no func_code --HG-- branch : 1.0.x --- CHANGELOG | 3 +++ py/test/pycollect.py | 12 +++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 82b6d7f48..6a6d151ea 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,9 @@ Changes between 1.0.0b3 and 1.0.0 * perform setup finalization before reporting failures +* apply modified from Andreas Kloeckner to allow + test functions to have no func_code + Changes between 1.0.0b1 and 1.0.0b3 ============================================= diff --git a/py/test/pycollect.py b/py/test/pycollect.py index eb010f66a..76394a588 100644 --- a/py/test/pycollect.py +++ b/py/test/pycollect.py @@ -133,11 +133,11 @@ class PyCollectorMixin(PyobjMixin, py.test.collect.Collector): res = self._deprecated_join(name) if res is not None: return res - if obj.func_code.co_flags & 32: # generator function + if is_generator(obj): # XXX deprecation warning return self.Generator(name, parent=self) - else: - return self._genfunctions(name, obj) + else: + return self._genfunctions(name, obj) def _genfunctions(self, name, funcobj): module = self.getparent(Module).obj @@ -152,6 +152,12 @@ class PyCollectorMixin(PyobjMixin, py.test.collect.Collector): return self.Function(name, parent=self) return funcargs.FunctionCollector(name=name, parent=self, calls=metafunc._calls) + +def is_generator(func): + try: + return (func.func_code.co_flags & 32) # generator function + except AttributeError: # c / builtin functions have no func_code + return False class Module(py.test.collect.File, PyCollectorMixin): def _getobj(self): From c491a708e0b07a08e052fc52d78d1467d1f1f965 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 24 Jun 2009 16:04:42 +0200 Subject: [PATCH 05/15] add test and fix keyword recogniation, thanks Andreas Kloeckner --HG-- branch : 1.0.x --- CHANGELOG | 5 +++-- py/test/collect.py | 2 +- py/test/testing/test_genitems.py | 13 +++++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 6a6d151ea..a9ff36b22 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,8 +6,9 @@ Changes between 1.0.0b3 and 1.0.0 * perform setup finalization before reporting failures -* apply modified from Andreas Kloeckner to allow - test functions to have no func_code +* apply modified patches from Andreas Kloeckner to allow + test functions to have no func_code (#22) and to make + "-k" and function keywords work (#20) Changes between 1.0.0b1 and 1.0.0b3 ============================================= diff --git a/py/test/collect.py b/py/test/collect.py index 33611274d..a56ec496c 100644 --- a/py/test/collect.py +++ b/py/test/collect.py @@ -204,7 +204,7 @@ class Node(object): def _matchonekeyword(self, key, chain): elems = key.split(".") # XXX O(n^2), anyone cares? - chain = [item._keywords() for item in chain if item._keywords()] + chain = [item.readkeywords() for item in chain if item._keywords()] for start, _ in enumerate(chain): if start + len(elems) > len(chain): return False diff --git a/py/test/testing/test_genitems.py b/py/test/testing/test_genitems.py index f917e5386..ebe7a9f6f 100644 --- a/py/test/testing/test_genitems.py +++ b/py/test/testing/test_genitems.py @@ -121,3 +121,16 @@ class TestKeywordSelection: item = dlist[0].items[0] assert item.name == "test_one" + + def test_keyword_extra(self, testdir): + p = testdir.makepyfile(""" + def test_one(): + assert 0 + test_one.mykeyword = True + """) + reprec = testdir.inline_run("-k", "-mykeyword", p) + passed, skipped, failed = reprec.countoutcomes() + assert passed + skipped + failed == 0 + reprec = testdir.inline_run("-k", "mykeyword", p) + passed, skipped, failed = reprec.countoutcomes() + assert failed == 1 From 49c4027df33daf58b60e2206bce8337e04170cf4 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 24 Jun 2009 16:20:14 +0200 Subject: [PATCH 06/15] regen setup.py, already bump trove classifier --HG-- branch : 1.0.x --- MANIFEST | 386 +++++++++++++++++++++++++++++++++++++++++++++++++ py/__init__.py | 2 +- setup.py | 60 ++++++-- 3 files changed, 438 insertions(+), 10 deletions(-) diff --git a/MANIFEST b/MANIFEST index e69de29bb..2919e5156 100644 --- a/MANIFEST +++ b/MANIFEST @@ -0,0 +1,386 @@ +MANIFEST +py/__init__.py +setup.py +.hgignore +.hgtags +CHANGELOG +LICENSE +README.txt +_findpy.py +doc/announce/release-0.9.0.txt +doc/announce/release-0.9.2.txt +doc/announce/release-1.0.0.txt +doc/announce/releases.txt +doc/bin.txt +doc/code.txt +doc/confrest.py +doc/conftest.py +doc/contact.txt +doc/download.txt +doc/execnet.txt +doc/img/pylib.png +doc/index.txt +doc/io.txt +doc/log.txt +doc/misc.txt +doc/path.txt +doc/style.css +doc/test/attic.txt +doc/test/config.txt +doc/test/dist.txt +doc/test/examples.txt +doc/test/extend.txt +doc/test/features.txt +doc/test/funcargs.txt +doc/test/quickstart.txt +doc/test/test.txt +doc/test/xunit_setup.txt +doc/xml.txt +example/execnet/popen_read_multiple.py +example/funcarg/costlysetup/conftest.py +example/funcarg/costlysetup/sub1/test_quick.py +example/funcarg/costlysetup/sub2/test_two.py +example/funcarg/mysetup/__init__.py +example/funcarg/mysetup/conftest.py +example/funcarg/mysetup/myapp.py +example/funcarg/mysetup/test_sample.py +example/funcarg/mysetup2/__init__.py +example/funcarg/mysetup2/conftest.py +example/funcarg/mysetup2/myapp.py +example/funcarg/mysetup2/test_sample.py +example/funcarg/mysetup2/test_ssh.py +example/funcarg/parametrize/test_parametrize.py +example/funcarg/parametrize/test_parametrize2.py +example/funcarg/parametrize/test_parametrize3.py +example/funcarg/test_simpleprovider.py +example/genhtml.py +example/genhtmlcss.py +example/genxml.py +example/pytest/failure_demo.py +example/pytest/test_failures.py +example/pytest/test_setup_flow_example.py +ez_setup.py +py/LICENSE +py/_com.py +py/bin/_findpy.py +py/bin/_genscripts.py +py/bin/gendoc.py +py/bin/py.cleanup +py/bin/py.countloc +py/bin/py.lookup +py/bin/py.rest +py/bin/py.svnwcrevert +py/bin/py.test +py/bin/py.which +py/bin/win32/py.cleanup.cmd +py/bin/win32/py.countloc.cmd +py/bin/win32/py.lookup.cmd +py/bin/win32/py.rest.cmd +py/bin/win32/py.svnwcrevert.cmd +py/bin/win32/py.test.cmd +py/bin/win32/py.which.cmd +py/builtin/__init__.py +py/builtin/enumerate.py +py/builtin/exception.py +py/builtin/reversed.py +py/builtin/set.py +py/builtin/sorted.py +py/builtin/testing/__init__.py +py/builtin/testing/test_enumerate.py +py/builtin/testing/test_exception.py +py/builtin/testing/test_reversed.py +py/builtin/testing/test_set.py +py/builtin/testing/test_sorted.py +py/cmdline/__init__.py +py/cmdline/pycleanup.py +py/cmdline/pycountloc.py +py/cmdline/pylookup.py +py/cmdline/pyrest.py +py/cmdline/pysvnwcrevert.py +py/cmdline/pytest.py +py/cmdline/pywhich.py +py/cmdline/testing/__init__.py +py/cmdline/testing/test_cmdline.py +py/cmdline/testing/test_generic.py +py/code/__init__.py +py/code/code.py +py/code/excinfo.py +py/code/frame.py +py/code/safe_repr.py +py/code/source.py +py/code/testing/__init__.py +py/code/testing/test_code.py +py/code/testing/test_excinfo.py +py/code/testing/test_frame.py +py/code/testing/test_safe_repr.py +py/code/testing/test_source.py +py/code/traceback2.py +py/compat/LICENSE +py/compat/__init__.py +py/compat/conftest.py +py/compat/doctest.py +py/compat/optparse.py +py/compat/subprocess.py +py/compat/testing/__init__.py +py/compat/testing/test_doctest.py +py/compat/testing/test_doctest.txt +py/compat/testing/test_doctest2.py +py/compat/testing/test_doctest2.txt +py/compat/testing/test_optparse.py +py/compat/testing/test_subprocess.py +py/compat/testing/test_textwrap.py +py/compat/textwrap.py +py/conftest.py +py/env.cmd +py/env.py +py/execnet/NOTES +py/execnet/__init__.py +py/execnet/channel.py +py/execnet/gateway.py +py/execnet/gwmanage.py +py/execnet/improve-remote-tracebacks.txt +py/execnet/inputoutput.py +py/execnet/message.py +py/execnet/multi.py +py/execnet/register.py +py/execnet/rsync.py +py/execnet/rsync_remote.py +py/execnet/script/__init__.py +py/execnet/script/loop_socketserver.py +py/execnet/script/quitserver.py +py/execnet/script/shell.py +py/execnet/script/socketserver.py +py/execnet/script/socketserverservice.py +py/execnet/script/xx.py +py/execnet/testing/__init__.py +py/execnet/testing/conftest.py +py/execnet/testing/test_event.py +py/execnet/testing/test_gateway.py +py/execnet/testing/test_gwmanage.py +py/execnet/testing/test_multi.py +py/execnet/testing/test_pickle.py +py/execnet/testing/test_rsync.py +py/execnet/testing/test_xspec.py +py/execnet/xspec.py +py/initpkg.py +py/io/__init__.py +py/io/dupfile.py +py/io/fdcapture.py +py/io/stdcapture.py +py/io/terminalwriter.py +py/io/testing/__init__.py +py/io/testing/test_dupfile.py +py/io/testing/test_fdcapture.py +py/io/testing/test_stdcapture.py +py/io/testing/test_terminalwriter.py +py/log/__init__.py +py/log/consumer.py +py/log/logger.py +py/log/producer.py +py/log/testing/__init__.py +py/log/testing/test_log.py +py/log/testing/test_logger.py +py/log/testing/test_warning.py +py/log/warning.py +py/magic/__init__.py +py/magic/assertion.py +py/magic/autopath.py +py/magic/exprinfo.py +py/magic/invoke.py +py/magic/patch.py +py/magic/testing/__init__.py +py/magic/testing/test_assertion.py +py/magic/testing/test_autopath.py +py/magic/testing/test_exprinfo.py +py/magic/testing/test_invoke.py +py/magic/testing/test_patch.py +py/magic/testing/test_viewtype.py +py/magic/viewtype.py +py/misc/__init__.py +py/misc/_dist.py +py/misc/buildcmodule.py +py/misc/cache.py +py/misc/cmdline/__init__.py +py/misc/cmdline/countloc.py +py/misc/difftime.py +py/misc/dynpkg.py +py/misc/error.py +py/misc/findmissingdocstrings.py +py/misc/rest.py +py/misc/std.py +py/misc/svnlook.py +py/misc/terminal_helper.py +py/misc/testing/__init__.py +py/misc/testing/data/svnlookrepo.dump +py/misc/testing/test_api.py +py/misc/testing/test_cache.py +py/misc/testing/test_com.py +py/misc/testing/test_error.py +py/misc/testing/test_initpkg.py +py/misc/testing/test_std.py +py/misc/testing/test_svnlook.py +py/misc/testing/test_terminal.py +py/path/__init__.py +py/path/common.py +py/path/gateway/TODO.txt +py/path/gateway/__init__.py +py/path/gateway/channeltest.py +py/path/gateway/channeltest2.py +py/path/gateway/remotepath.py +py/path/local/__init__.py +py/path/local/common.py +py/path/local/local.py +py/path/local/posix.py +py/path/local/testing/__init__.py +py/path/local/testing/test_local.py +py/path/local/testing/test_posix.py +py/path/local/testing/test_win.py +py/path/local/win.py +py/path/svn/__init__.py +py/path/svn/cache.py +py/path/svn/quoting.txt +py/path/svn/svncommon.py +py/path/svn/testing/__init__.py +py/path/svn/testing/repotest.dump +py/path/svn/testing/svntestbase.py +py/path/svn/testing/test_auth.py +py/path/svn/testing/test_test_repo.py +py/path/svn/testing/test_urlcommand.py +py/path/svn/testing/test_wccommand.py +py/path/svn/urlcommand.py +py/path/svn/wccommand.py +py/path/testing/__init__.py +py/path/testing/common.py +py/path/testing/fscommon.py +py/path/testing/test_api.py +py/process/__init__.py +py/process/cmdexec.py +py/process/forkedfunc.py +py/process/killproc.py +py/process/testing/__init__.py +py/process/testing/test_cmdexec.py +py/process/testing/test_forkedfunc.py +py/process/testing/test_killproc.py +py/rest/__init__.py +py/rest/convert.py +py/rest/directive.py +py/rest/latex.py +py/rest/rest.sty.template +py/rest/rst.py +py/rest/testing/__init__.py +py/rest/testing/data/example.rst2pdfconfig +py/rest/testing/data/example1.dot +py/rest/testing/data/formula.txt +py/rest/testing/data/formula1.txt +py/rest/testing/data/graphviz.txt +py/rest/testing/data/part1.txt +py/rest/testing/data/part2.txt +py/rest/testing/data/tocdepth.rst2pdfconfig +py/rest/testing/setup.py +py/rest/testing/test_convert.py +py/rest/testing/test_directive.py +py/rest/testing/test_htmlrest.py +py/rest/testing/test_rst.py +py/rest/testing/test_rst2pdf.py +py/rest/testing/test_transform.py +py/rest/transform.py +py/test/__init__.py +py/test/cmdline.py +py/test/collect.py +py/test/compat.py +py/test/config.py +py/test/conftesthandle.py +py/test/defaultconftest.py +py/test/dist/__init__.py +py/test/dist/dsession.py +py/test/dist/mypickle.py +py/test/dist/nodemanage.py +py/test/dist/testing/__init__.py +py/test/dist/testing/test_dsession.py +py/test/dist/testing/test_mypickle.py +py/test/dist/testing/test_nodemanage.py +py/test/dist/testing/test_txnode.py +py/test/dist/txnode.py +py/test/funcargs.py +py/test/looponfail/__init__.py +py/test/looponfail/remote.py +py/test/looponfail/testing/__init__.py +py/test/looponfail/testing/test_remote.py +py/test/looponfail/testing/test_util.py +py/test/looponfail/util.py +py/test/outcome.py +py/test/parseopt.py +py/test/plugin/__init__.py +py/test/plugin/conftest.py +py/test/plugin/hookspec.py +py/test/plugin/pytest__pytest.py +py/test/plugin/pytest_default.py +py/test/plugin/pytest_doctest.py +py/test/plugin/pytest_execnetcleanup.py +py/test/plugin/pytest_figleaf.py +py/test/plugin/pytest_hooklog.py +py/test/plugin/pytest_iocapture.py +py/test/plugin/pytest_monkeypatch.py +py/test/plugin/pytest_pdb.py +py/test/plugin/pytest_pocoo.py +py/test/plugin/pytest_pylint.py +py/test/plugin/pytest_pytester.py +py/test/plugin/pytest_recwarn.py +py/test/plugin/pytest_restdoc.py +py/test/plugin/pytest_resultdb.py +py/test/plugin/pytest_resultlog.py +py/test/plugin/pytest_runner.py +py/test/plugin/pytest_terminal.py +py/test/plugin/pytest_tmpdir.py +py/test/plugin/pytest_unittest.py +py/test/plugin/pytest_xfail.py +py/test/plugin/test_pytest_runner.py +py/test/pluginmanager.py +py/test/pycollect.py +py/test/session.py +py/test/testing/__init__.py +py/test/testing/acceptance_test.py +py/test/testing/conftest.py +py/test/testing/import_test/package/__init__.py +py/test/testing/import_test/package/absolute_import_shared_lib.py +py/test/testing/import_test/package/module_that_imports_shared_lib.py +py/test/testing/import_test/package/shared_lib.py +py/test/testing/import_test/package/test_import.py +py/test/testing/test_collect.py +py/test/testing/test_compat.py +py/test/testing/test_config.py +py/test/testing/test_conftesthandle.py +py/test/testing/test_deprecated_api.py +py/test/testing/test_funcargs.py +py/test/testing/test_genitems.py +py/test/testing/test_outcome.py +py/test/testing/test_parseopt.py +py/test/testing/test_pickling.py +py/test/testing/test_pluginmanager.py +py/test/testing/test_pycollect.py +py/test/testing/test_recording.py +py/test/testing/test_session.py +py/test/testing/test_setup_functional.py +py/test/testing/test_traceback.py +py/test/web/__init__.py +py/test/web/exception.py +py/test/web/post_multipart.py +py/test/web/webcheck.py +py/thread/__init__.py +py/thread/io.py +py/thread/pool.py +py/thread/testing/__init__.py +py/thread/testing/test_io.py +py/thread/testing/test_pool.py +py/tool/__init__.py +py/tool/testing/__init__.py +py/tool/testing/test_utestconvert.py +py/tool/utestconvert.py +py/xmlobj/__init__.py +py/xmlobj/html.py +py/xmlobj/misc.py +py/xmlobj/testing/__init__.py +py/xmlobj/testing/test_html.py +py/xmlobj/testing/test_xml.py +py/xmlobj/visit.py +py/xmlobj/xml.py \ No newline at end of file diff --git a/py/__init__.py b/py/__init__.py index 97bebde57..e177d9a4e 100644 --- a/py/__init__.py +++ b/py/__init__.py @@ -31,7 +31,7 @@ initpkg(__name__, author_email = "holger at merlinux.eu, py-dev at codespeak.net", long_description = globals()['__doc__'], classifiers = [ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: POSIX", diff --git a/setup.py b/setup.py index ed77c5b18..610124d96 100644 --- a/setup.py +++ b/setup.py @@ -2,12 +2,12 @@ autogenerated by gensetup.py setup file for 'py' package based on: -changeset: 1165:0516498708b6 -branch: trunk +changeset: 1170:4fa7081c2758 +branch: 1.0.x tag: tip user: holger krekel -date: Tue Jun 23 12:12:45 2009 +0200 -summary: remove TODO file (mostly done, superflous or in the issue tracker), +date: Wed Jun 24 16:04:42 2009 +0200 +summary: add test and fix keyword recogniation, thanks Andreas Kloeckner """ @@ -15,8 +15,8 @@ import os, sys import ez_setup ez_setup.use_setuptools() -from setuptools import setup, Extension - +from setuptools import setup + long_description = """ advanced testing and development support library: @@ -48,8 +48,14 @@ def main(): author='holger krekel, Guido Wesdorp, Carl Friedrich Bolz, Armin Rigo, Maciej Fijalkowski & others', author_email='holger at merlinux.eu, py-dev at codespeak.net', - entry_points={'console_scripts': []}, - classifiers=['Development Status :: 4 - Beta', + entry_points={'console_scripts': ['py.cleanup = py.cmdline:pycleanup', + 'py.countloc = py.cmdline:pycountloc', + 'py.lookup = py.cmdline:pylookup', + 'py.rest = py.cmdline:pyrest', + 'py.svnwcrevert = py.cmdline:pysvnwcrevert', + 'py.test = py.cmdline:pytest', + 'py.which = py.cmdline:pywhich']}, + classifiers=['Development Status :: 5 - Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Operating System :: POSIX', @@ -61,7 +67,43 @@ def main(): 'Topic :: Utilities', 'Programming Language :: Python'], packages=[], - package_data={'py': []}, + package_data={'py': ['LICENSE', + 'bin/_findpy.py', + 'bin/_genscripts.py', + 'bin/gendoc.py', + 'bin/py.cleanup', + 'bin/py.countloc', + 'bin/py.lookup', + 'bin/py.rest', + 'bin/py.svnwcrevert', + 'bin/py.test', + 'bin/py.which', + 'bin/win32/py.cleanup.cmd', + 'bin/win32/py.countloc.cmd', + 'bin/win32/py.lookup.cmd', + 'bin/win32/py.rest.cmd', + 'bin/win32/py.svnwcrevert.cmd', + 'bin/win32/py.test.cmd', + 'bin/win32/py.which.cmd', + 'compat/LICENSE', + 'compat/testing/test_doctest.txt', + 'compat/testing/test_doctest2.txt', + 'env.cmd', + 'execnet/NOTES', + 'execnet/improve-remote-tracebacks.txt', + 'misc/testing/data/svnlookrepo.dump', + 'path/gateway/TODO.txt', + 'path/svn/quoting.txt', + 'path/svn/testing/repotest.dump', + 'rest/rest.sty.template', + 'rest/testing/data/example.rst2pdfconfig', + 'rest/testing/data/example1.dot', + 'rest/testing/data/formula.txt', + 'rest/testing/data/formula1.txt', + 'rest/testing/data/graphviz.txt', + 'rest/testing/data/part1.txt', + 'rest/testing/data/part2.txt', + 'rest/testing/data/tocdepth.rst2pdfconfig']}, zip_safe=False, ) From 74ba91dd506a2b2d883e42a80202a4a4a37a0930 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 24 Jun 2009 16:24:20 +0200 Subject: [PATCH 07/15] resolve issue 23 --HG-- branch : 1.0.x --- CHANGELOG | 5 ++++- py/io/stdcapture.py | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index a9ff36b22..4bdf9dab1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,7 +8,10 @@ Changes between 1.0.0b3 and 1.0.0 * apply modified patches from Andreas Kloeckner to allow test functions to have no func_code (#22) and to make - "-k" and function keywords work (#20) + "-k" and function keywords work (#20) + +* apply patch from Daniel Peolzleithner (issue #23) + Changes between 1.0.0b1 and 1.0.0b3 ============================================= diff --git a/py/io/stdcapture.py b/py/io/stdcapture.py index 2c4bd376c..eed9fb029 100644 --- a/py/io/stdcapture.py +++ b/py/io/stdcapture.py @@ -137,6 +137,9 @@ class DontReadFromInput: readlines = read __iter__ = read + def isatty(self): + return False + try: devnullpath = os.devnull except AttributeError: From 2b12f3f538d8895a3bf168618241ce241e076c6c Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 24 Jun 2009 16:35:01 +0200 Subject: [PATCH 08/15] resolves issue 18 multiprocessing py.test co-existence add fileno() method and test DontReadFromInput redirection some more --HG-- branch : 1.0.x --- CHANGELOG | 2 ++ py/io/stdcapture.py | 6 ++++-- py/io/testing/test_stdcapture.py | 9 +++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 4bdf9dab1..f0a0e9e91 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -12,6 +12,8 @@ Changes between 1.0.0b3 and 1.0.0 * apply patch from Daniel Peolzleithner (issue #23) +* resolve issue #18, multiprocessing.Manager() and + redirection clash Changes between 1.0.0b1 and 1.0.0b3 ============================================= diff --git a/py/io/stdcapture.py b/py/io/stdcapture.py index eed9fb029..a43d4bf0e 100644 --- a/py/io/stdcapture.py +++ b/py/io/stdcapture.py @@ -136,9 +136,11 @@ class DontReadFromInput: readline = read readlines = read __iter__ = read - + + def fileno(self): + raise ValueError("redirected Stdin is pseudofile, has no fileno()") def isatty(self): - return False + return False try: devnullpath = os.devnull diff --git a/py/io/testing/test_stdcapture.py b/py/io/testing/test_stdcapture.py index e6cb8ea1f..5e857c5b2 100644 --- a/py/io/testing/test_stdcapture.py +++ b/py/io/testing/test_stdcapture.py @@ -1,6 +1,15 @@ import os, sys import py +def test_dontreadfrominput(): + from py.__.io.stdcapture import DontReadFromInput + f = DontReadFromInput() + assert not f.isatty() + py.test.raises(IOError, f.read) + py.test.raises(IOError, f.readlines) + py.test.raises(IOError, iter, f) + py.test.raises(ValueError, f.fileno) + class TestStdCapture: def getcapture(self, **kw): return py.io.StdCapture(**kw) From a137b6237022cdc7adb6e86e79cb9d1bb6f979bf Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 24 Jun 2009 16:57:55 +0200 Subject: [PATCH 09/15] add py.test version to verbose reporting correctly regen setup --HG-- branch : 1.0.x --- MANIFEST | 4 +-- py/test/plugin/pytest_terminal.py | 1 + setup.py | 57 ++++++++++++++++++++++++++----- 3 files changed, 52 insertions(+), 10 deletions(-) diff --git a/MANIFEST b/MANIFEST index 2919e5156..5b3176209 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,5 +1,5 @@ MANIFEST -py/__init__.py +py/test/plugin/pytest_terminal.py setup.py .hgignore .hgtags @@ -61,6 +61,7 @@ example/pytest/test_failures.py example/pytest/test_setup_flow_example.py ez_setup.py py/LICENSE +py/__init__.py py/_com.py py/bin/_findpy.py py/bin/_genscripts.py @@ -330,7 +331,6 @@ py/test/plugin/pytest_restdoc.py py/test/plugin/pytest_resultdb.py py/test/plugin/pytest_resultlog.py py/test/plugin/pytest_runner.py -py/test/plugin/pytest_terminal.py py/test/plugin/pytest_tmpdir.py py/test/plugin/pytest_unittest.py py/test/plugin/pytest_xfail.py diff --git a/py/test/plugin/pytest_terminal.py b/py/test/plugin/pytest_terminal.py index 491c500a3..1133efbbd 100644 --- a/py/test/plugin/pytest_terminal.py +++ b/py/test/plugin/pytest_terminal.py @@ -204,6 +204,7 @@ class TerminalReporter: msg = "python: platform %s -- Python %s" % (sys.platform, verinfo) if self.config.option.verbose or self.config.option.debug: msg += " -- " + str(sys.executable) + msg += " -- pytest-%s" % (py.__version__) self.write_line(msg) if self.config.option.debug or self.config.option.traceconfig: diff --git a/setup.py b/setup.py index 610124d96..a1b14ea9d 100644 --- a/setup.py +++ b/setup.py @@ -2,13 +2,9 @@ autogenerated by gensetup.py setup file for 'py' package based on: -changeset: 1170:4fa7081c2758 -branch: 1.0.x -tag: tip -user: holger krekel -date: Wed Jun 24 16:04:42 2009 +0200 -summary: add test and fix keyword recogniation, thanks Andreas Kloeckner - +tags: tip +branch: 1.0.x +revision: 1173:33348724fd55e40d1dfaab26575811a1ecdd38f1 """ import os, sys @@ -66,7 +62,52 @@ def main(): 'Topic :: System :: Distributed Computing', 'Topic :: Utilities', 'Programming Language :: Python'], - packages=[], + packages=['py.builtin', + 'py.builtin.testing', + 'py.cmdline', + 'py.cmdline.testing', + 'py.code', + 'py.code.testing', + 'py.compat', + 'py.compat.testing', + 'py.execnet', + 'py.execnet.script', + 'py.execnet.testing', + 'py.io', + 'py.io.testing', + 'py.log', + 'py.log.testing', + 'py.magic', + 'py.magic.testing', + 'py.misc', + 'py.misc.cmdline', + 'py.misc.testing', + 'py.path', + 'py.path.gateway', + 'py.path.local', + 'py.path.local.testing', + 'py.path.svn', + 'py.path.svn.testing', + 'py.path.testing', + 'py.process', + 'py.process.testing', + 'py.rest', + 'py.rest.testing', + 'py.test', + 'py.test.dist', + 'py.test.dist.testing', + 'py.test.looponfail', + 'py.test.looponfail.testing', + 'py.test.plugin', + 'py.test.testing', + 'py.test.testing.import_test.package', + 'py.test.web', + 'py.thread', + 'py.thread.testing', + 'py.tool', + 'py.tool.testing', + 'py.xmlobj', + 'py.xmlobj.testing'], package_data={'py': ['LICENSE', 'bin/_findpy.py', 'bin/_genscripts.py', From 0e03c605a2e224977809ef4460f10a98b2e26b24 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 24 Jun 2009 17:13:04 +0200 Subject: [PATCH 10/15] Added tag 1.0.0b4 for changeset 1c7aaa8c61f3 --HG-- branch : 1.0.x --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index e152cc457..36d93b38f 100644 --- a/.hgtags +++ b/.hgtags @@ -1 +1,2 @@ 52c6d9e78777a5a34e813123997dfc614a1a4767 1.0.0b3 +1c7aaa8c61f3b0945921a9acc7beb184201aed4b 1.0.0b4 From eab96fba7870e842ebcb7bff653be3cfa297afc1 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 24 Jun 2009 17:13:54 +0200 Subject: [PATCH 11/15] Removed tag 1.0.0b4 --HG-- branch : 1.0.x --- .hgtags | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.hgtags b/.hgtags index 36d93b38f..ec170b2db 100644 --- a/.hgtags +++ b/.hgtags @@ -1,2 +1,4 @@ 52c6d9e78777a5a34e813123997dfc614a1a4767 1.0.0b3 1c7aaa8c61f3b0945921a9acc7beb184201aed4b 1.0.0b4 +1c7aaa8c61f3b0945921a9acc7beb184201aed4b 1.0.0b4 +0000000000000000000000000000000000000000 1.0.0b4 From fac10cb8eec146925f2eb16a8e6e584a3c7b07bd Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 24 Jun 2009 17:14:26 +0200 Subject: [PATCH 12/15] Added tag 1.0.0b4 for changeset 8cd6eb91eba3 --HG-- branch : 1.0.x --- .hgtags | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.hgtags b/.hgtags index ec170b2db..8764b3c9e 100644 --- a/.hgtags +++ b/.hgtags @@ -2,3 +2,5 @@ 1c7aaa8c61f3b0945921a9acc7beb184201aed4b 1.0.0b4 1c7aaa8c61f3b0945921a9acc7beb184201aed4b 1.0.0b4 0000000000000000000000000000000000000000 1.0.0b4 +0000000000000000000000000000000000000000 1.0.0b4 +8cd6eb91eba313b012d6e568f37d844dc0751f2e 1.0.0b4 From e6210806fe976ee18a506bbbfa2121960c37c4a1 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 24 Jun 2009 17:23:09 +0200 Subject: [PATCH 13/15] tag revision 1.0.0b4 for upload --HG-- branch : 1.0.x --- MANIFEST | 4 ++-- py/__init__.py | 4 ++-- setup.py | 7 +++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/MANIFEST b/MANIFEST index 5b3176209..2919e5156 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,5 +1,5 @@ MANIFEST -py/test/plugin/pytest_terminal.py +py/__init__.py setup.py .hgignore .hgtags @@ -61,7 +61,6 @@ example/pytest/test_failures.py example/pytest/test_setup_flow_example.py ez_setup.py py/LICENSE -py/__init__.py py/_com.py py/bin/_findpy.py py/bin/_genscripts.py @@ -331,6 +330,7 @@ py/test/plugin/pytest_restdoc.py py/test/plugin/pytest_resultdb.py py/test/plugin/pytest_resultlog.py py/test/plugin/pytest_runner.py +py/test/plugin/pytest_terminal.py py/test/plugin/pytest_tmpdir.py py/test/plugin/pytest_unittest.py py/test/plugin/pytest_xfail.py diff --git a/py/__init__.py b/py/__init__.py index e177d9a4e..f70ee1994 100644 --- a/py/__init__.py +++ b/py/__init__.py @@ -19,7 +19,7 @@ For questions please check out http://pylib.org/contact.html """ from initpkg import initpkg -version = "1.0.x" +version = "1.0.0b4" initpkg(__name__, description = "py.test and pylib: advanced testing tool and networking lib", @@ -31,7 +31,7 @@ initpkg(__name__, author_email = "holger at merlinux.eu, py-dev at codespeak.net", long_description = globals()['__doc__'], classifiers = [ - "Development Status :: 5 - Stable", + "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: POSIX", diff --git a/setup.py b/setup.py index a1b14ea9d..1408149ac 100644 --- a/setup.py +++ b/setup.py @@ -2,9 +2,8 @@ autogenerated by gensetup.py setup file for 'py' package based on: -tags: tip branch: 1.0.x -revision: 1173:33348724fd55e40d1dfaab26575811a1ecdd38f1 +revision: 1177:a0d05417421b8cc68c8ba1a96a7fd3087116e472 """ import os, sys @@ -37,7 +36,7 @@ def main(): name='py', description='py.test and pylib: advanced testing tool and networking lib', long_description = long_description, - version='1.0.x', + version='1.0.0b4', url='http://pylib.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], @@ -51,7 +50,7 @@ def main(): 'py.svnwcrevert = py.cmdline:pysvnwcrevert', 'py.test = py.cmdline:pytest', 'py.which = py.cmdline:pywhich']}, - classifiers=['Development Status :: 5 - Stable', + classifiers=['Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Operating System :: POSIX', From a6c07d6098fc89fdac3e1253e2c8767ade5d3e1d Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 24 Jun 2009 17:25:11 +0200 Subject: [PATCH 14/15] Removed tag 1.0.0b4 --HG-- branch : 1.0.x --- .hgtags | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.hgtags b/.hgtags index 8764b3c9e..e5cfd8b7a 100644 --- a/.hgtags +++ b/.hgtags @@ -4,3 +4,5 @@ 0000000000000000000000000000000000000000 1.0.0b4 0000000000000000000000000000000000000000 1.0.0b4 8cd6eb91eba313b012d6e568f37d844dc0751f2e 1.0.0b4 +8cd6eb91eba313b012d6e568f37d844dc0751f2e 1.0.0b4 +0000000000000000000000000000000000000000 1.0.0b4 From 250d58729d22c3a81a2fff80010a0e1f1dfcbdfe Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 24 Jun 2009 17:47:29 +0200 Subject: [PATCH 15/15] another attempt at a full tarball --HG-- branch : 1.0.x --- MANIFEST | 12 ++++++------ doc/announce/release-1.0.0.txt | 36 ++++++++++++++++++++++++---------- doc/download.txt | 2 +- setup.py | 2 +- 4 files changed, 34 insertions(+), 18 deletions(-) diff --git a/MANIFEST b/MANIFEST index 2919e5156..6e2ec07dd 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,22 +1,20 @@ -MANIFEST -py/__init__.py -setup.py +doc/announce/release-1.0.0.txt +doc/download.txt .hgignore .hgtags CHANGELOG LICENSE +MANIFEST README.txt _findpy.py doc/announce/release-0.9.0.txt doc/announce/release-0.9.2.txt -doc/announce/release-1.0.0.txt doc/announce/releases.txt doc/bin.txt doc/code.txt doc/confrest.py doc/conftest.py doc/contact.txt -doc/download.txt doc/execnet.txt doc/img/pylib.png doc/index.txt @@ -61,6 +59,7 @@ example/pytest/test_failures.py example/pytest/test_setup_flow_example.py ez_setup.py py/LICENSE +py/__init__.py py/_com.py py/bin/_findpy.py py/bin/_genscripts.py @@ -383,4 +382,5 @@ py/xmlobj/testing/__init__.py py/xmlobj/testing/test_html.py py/xmlobj/testing/test_xml.py py/xmlobj/visit.py -py/xmlobj/xml.py \ No newline at end of file +py/xmlobj/xml.py +setup.py \ No newline at end of file diff --git a/doc/announce/release-1.0.0.txt b/doc/announce/release-1.0.0.txt index a63b8b312..372eaf9aa 100644 --- a/doc/announce/release-1.0.0.txt +++ b/doc/announce/release-1.0.0.txt @@ -1,22 +1,38 @@ -py lib 1.0.0: distributed testing and dynamic code deployment -=============================================================== +py.test / py lib 1.0.0: distributed testing and dynamic code deployment +============================================================================ -XXX draft +Welcome to the 1.0 release bringing new flexibility and +power to testing with Python! Main news: -Welcome to the 1.0.0 py lib release - a python library aiming -to support agile and test-driven development. +* new py.test plugin architecture, some examples: -It works with Linux, OSX and Win32, on Python 2.3, 2.4, 2.5 and 2.6. + pytest_xfail.py: mark tests as "expected to fail" + pytest_pocoo.py: automatically send tracebacks to pocoo paste service + pytest_monkeypatch.py: safely patch parts of your environment in a test function + pytest_figleaf.py: generate html coverage reports + pytest_resultlog.py: generate buildbot-friendly output -Main API/Tool Features: + and much more! + +* funcargs - the new flexible mechanism for managing all your test setup/fixture needs! + +* flexibly distribute tests to multiple computers from the command line + +See the py.test documentation for more info: + + http://pytest.org + +The py lib contains the py.test tool and offers its well-tested code +independently from the testing tool, mainly: -* py.test: cross-project testing tool with many advanced features * py.execnet: ad-hoc code distribution to SSH, Socket and local sub processes * py.code: support for dynamically running and debugging python code * py.path: path abstractions over local and subversion files -Download/Install: http://codespeak.net/py/1.0.0/download.html -Documentation/API: http://codespeak.net/py/1.0.0/index.html +The whole package works well with Linux, OSX and Win32, on +Python 2.3, 2.4, 2.5 and 2.6. (Expect Python3 compatibility soon!) + +Download/Install: http://codespeak.net/py/dist/download.html best, holger diff --git a/doc/download.txt b/doc/download.txt index 170b2e1b5..39c02b91f 100644 --- a/doc/download.txt +++ b/doc/download.txt @@ -2,7 +2,7 @@ Downloading ============== -.. _`PyPI project page`: http://pypi.python.org/pypi?%3Aaction=pkg_edit&name=py +.. _`PyPI project page`: http://pypi.python.org/pypi/py/ Latest Release, see `PyPI project page`_ diff --git a/setup.py b/setup.py index 1408149ac..3068703cb 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ autogenerated by gensetup.py setup file for 'py' package based on: branch: 1.0.x -revision: 1177:a0d05417421b8cc68c8ba1a96a7fd3087116e472 +revision: 1179:b1781bbfef8f3382f149e4b271b4795ed98469da """ import os, sys