3 new commits in pytest: https://bitbucket.org/hpk42/pytest/commits/18a65f4e8303/ Changeset: 18a65f4e8303 User: hpk42 Date: 2013-07-26 07:51:33 Summary: add changelog: integrate option tab-completion when argcomplete is used. Thanks Anthon van der Neut for the PR. This also lets pytest use argparse instead of optparse. Affected #: 2 files
diff -r 4405d5fd6caec4072177911d9af4e1c57fe66cec -r 18a65f4e83033fb6ceaaf34b89bffee493f71f6d AUTHORS --- a/AUTHORS +++ b/AUTHORS @@ -34,3 +34,4 @@ Brian Okken Katarzyna Jachim Christian Theunert +Anthon van der Neut diff -r 4405d5fd6caec4072177911d9af4e1c57fe66cec -r 18a65f4e83033fb6ceaaf34b89bffee493f71f6d CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,10 @@ Changes between 2.3.5 and 2.4.DEV ----------------------------------- +- integrate option tab-completion when argcomplete is used. Thanks + Anthon van der Neut for the PR. This also lets pytest use argparse + instead of optparse. + - SO-17664702: call fixture finalizers even if the fixture function partially failed (finalizers would not always be called before) https://bitbucket.org/hpk42/pytest/commits/31bc337af337/ Changeset: 31bc337af337 User: hpk42 Date: 2013-07-26 08:59:29 Summary: merge doc changes Affected #: 6 files diff -r 18a65f4e83033fb6ceaaf34b89bffee493f71f6d -r 31bc337af337227d596eff0810bd9aa63b796dbc doc/en/goodpractises.txt --- a/doc/en/goodpractises.txt +++ b/doc/en/goodpractises.txt @@ -23,7 +23,7 @@ If you frequently release code to the public you may want to look into `tox`_, the virtualenv test automation -tool and its `pytest support <http://codespeak.net/tox/example/pytest.html>`_. +tool and its `pytest support <http://testrun.org/tox/latest/example/pytest.html>`_. The basic idea is to generate a JUnitXML file through the ``--junitxml=PATH`` option and have a continuous integration server like Jenkins_ pick it up and generate reports. diff -r 18a65f4e83033fb6ceaaf34b89bffee493f71f6d -r 31bc337af337227d596eff0810bd9aa63b796dbc doc/en/links.inc --- a/doc/en/links.inc +++ b/doc/en/links.inc @@ -17,5 +17,5 @@ .. _`virtualenv`: http://pypi.python.org/pypi/virtualenv .. _hudson: http://hudson-ci.org/ .. _jenkins: http://jenkins-ci.org/ -.. _tox: http://codespeak.net/tox +.. _tox: http://testrun.org/tox .. _pylib: http://pylib.org diff -r 18a65f4e83033fb6ceaaf34b89bffee493f71f6d -r 31bc337af337227d596eff0810bd9aa63b796dbc doc/en/projects.txt --- a/doc/en/projects.txt +++ b/doc/en/projects.txt @@ -26,7 +26,7 @@ `16000 tests <http://buildbot.pypy.org/summary?branch=%3Ctrunk%3E>`_ * the `MoinMoin <http://moinmo.in>`_ Wiki Engine * `sentry <https://getsentry.com/welcome/>`_, realtime app-maintenance and exception tracking -* `tox <http://codespeak.net/tox>`_, virtualenv/Hudson integration tool +* `tox <http://testrun.org/tox>`_, virtualenv/Hudson integration tool * `PIDA <http://pida.co.uk>`_ framework for integrated development * `PyPM <http://code.activestate.com/pypm/>`_ ActiveState's package manager * `Fom <http://packages.python.org/Fom/>`_ a fluid object mapper for FluidDB diff -r 18a65f4e83033fb6ceaaf34b89bffee493f71f6d -r 31bc337af337227d596eff0810bd9aa63b796dbc doc/ja/goodpractises.txt --- a/doc/ja/goodpractises.txt +++ b/doc/ja/goodpractises.txt @@ -39,11 +39,11 @@ .. If you frequently release code to the public you may want to look into `tox`_, the virtualenv test automation - tool and its `pytest support <http://codespeak.net/tox/example/pytest.html>`_. + tool and its `pytest support <http://testrun.org/tox/latest/example/pytest.html>`_. The basic idea is to generate a JUnitXML file through the ``--junitxml=PATH`` option and have a continuous integration server like Jenkins_ pick it up and generate reports. -もし頻繁にコードを一般向けにリリースするなら、virtualenv のテスト自動化とその `pytest サポート <http://codespeak.net/tox/example/pytest.html>`_ を行う `tox`_ を調べてみたくなるでしょう。基本的な考え方は、 ``--junitxml=PATH`` オプションにより JUnitXML ファイルを生成します。そして Jenkins_ のような継続的インテグレーションサーバーがそのファイルを取得してレポートを生成します。 +もし頻繁にコードを一般向けにリリースするなら、virtualenv のテスト自動化とその `pytest サポート <http://testrun.org/tox/latest/example/pytest.html>`_ を行う `tox`_ を調べてみたくなるでしょう。基本的な考え方は、 ``--junitxml=PATH`` オプションにより JUnitXML ファイルを生成します。そして Jenkins_ のような継続的インテグレーションサーバーがそのファイルを取得してレポートを生成します。 .. _standalone: .. _`genscript method`: diff -r 18a65f4e83033fb6ceaaf34b89bffee493f71f6d -r 31bc337af337227d596eff0810bd9aa63b796dbc doc/ja/links.inc --- a/doc/ja/links.inc +++ b/doc/ja/links.inc @@ -17,4 +17,4 @@ .. _`virtualenv`: http://pypi.python.org/pypi/virtualenv .. _hudson: http://hudson-ci.org/ .. _jenkins: http://jenkins-ci.org/ -.. _tox: http://codespeak.net/tox +.. _tox: http://testrun.org/tox diff -r 18a65f4e83033fb6ceaaf34b89bffee493f71f6d -r 31bc337af337227d596eff0810bd9aa63b796dbc doc/ja/projects.txt --- a/doc/ja/projects.txt +++ b/doc/ja/projects.txt @@ -16,7 +16,7 @@ * `PyPy <http://pypy.org>`_, Python with a JIT compiler, running over `16000 tests <http://buildbot.pypy.org/summary?branch=%3Ctrunk%3E>`_ * the `MoinMoin <http://moinmo.in>`_ Wiki Engine - * `tox <http://codespeak.net/tox>`_, virtualenv/Hudson integration tool + * `tox <http://testrun.org/tox>`_, virtualenv/Hudson integration tool * `PIDA <http://pida.co.uk>`_ framework for integrated development * `PyPM <http://code.activestate.com/pypm/>`_ ActiveState's package manager * `Fom <http://packages.python.org/Fom/>`_ a fluid object mapper for FluidDB @@ -49,7 +49,7 @@ * `PyPy <http://pypy.org>`_: JIT コンパイラーを備えた Python、 `16000 テスト <http://buildbot.pypy.org/summary?branch=%3Ctrunk%3E>`_ 以上を実行 * `MoinMoin <http://moinmo.in>`_: Wiki エンジン -* `tox <http://codespeak.net/tox>`_: virtualenv/Jenkins インテグレーションツール +* `tox <http://testrun.org/tox>`_: virtualenv/Jenkins インテグレーションツール * `PIDA <http://pida.co.uk>`_: 統合開発フレームワーク * `PyPM <http://code.activestate.com/pypm/>`_: Activestate 社のパッケージマネージャー * `Fom <http://packages.python.org/Fom/>`_: FluidDB の fluid オブジェクトマッパー https://bitbucket.org/hpk42/pytest/commits/085883326638/ Changeset: 085883326638 User: hpk42 Date: 2013-07-26 08:59:31 Summary: make genscript provide information as to compatibility (now that argparse is a dependency on python2.6) Affected #: 7 files diff -r 31bc337af337227d596eff0810bd9aa63b796dbc -r 085883326638467e244499fb4c781452ad850548 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -1,9 +1,12 @@ Changes between 2.3.5 and 2.4.DEV ----------------------------------- -- integrate option tab-completion when argcomplete is used. Thanks - Anthon van der Neut for the PR. This also lets pytest use argparse - instead of optparse. +- integrate tab-completion on options through use of "argcomplete". + Thanks Anthon van der Neut for the PR. + +- pytest now uses argparse instead of optparse (thanks Anthon) which + means that "argparse" is added as a dependency if installing into python2.6 + environments or below. - SO-17664702: call fixture finalizers even if the fixture function partially failed (finalizers would not always be called before) @@ -68,6 +71,13 @@ - better parametrize error messages, thanks Brianna Laugher +known incompatibilities: + +- if calling --genscript from python2.7 or above, you only get a + standalone script which works on python2.7 or above. Use Python2.6 + to also get a python2.5 compatible version. + + Changes between 2.3.4 and 2.3.5 ----------------------------------- diff -r 31bc337af337227d596eff0810bd9aa63b796dbc -r 085883326638467e244499fb4c781452ad850548 _pytest/genscript.py --- a/_pytest/genscript.py +++ b/_pytest/genscript.py @@ -1,5 +1,6 @@ """ generate a single-file self-contained version of py.test """ import py +import sys def find_toplevel(name): for syspath in py.std.sys.path: @@ -59,11 +60,21 @@ def pytest_cmdline_main(config): genscript = config.getvalue("genscript") if genscript: + tw = py.io.TerminalWriter() + deps = ['py', '_pytest', 'pytest'] + if sys.version_info < (2,7): + deps.append("argparse") + tw.line("generated script will run on python2.5-python3.3++") + else: + tw.line("WARNING: generated script will not run on python2.6 " + "or below due to 'argparse' dependency. Use python2.6 " + "to generate a python2.5/6 compatible script", red=True) script = generate_script( 'import py; raise SystemExit(py.test.cmdline.main())', - ['py', '_pytest', 'pytest'], + deps, ) - genscript = py.path.local(genscript) genscript.write(script) + tw.line("generated pytest standalone script: %s" % genscript, + bold=True) return 0 diff -r 31bc337af337227d596eff0810bd9aa63b796dbc -r 085883326638467e244499fb4c781452ad850548 _pytest/standalonetemplate.py --- a/_pytest/standalonetemplate.py +++ b/_pytest/standalonetemplate.py @@ -13,6 +13,10 @@ self.sources = sources def find_module(self, fullname, path=None): + if fullname == "argparse" and sys.version_info >= (2,7): + # we were generated with <python2.7 (which pulls in argparse) + # but we are running now on a stdlib which has it, so use that. + return None if fullname in self.sources: return self if fullname + '.__init__' in self.sources: diff -r 31bc337af337227d596eff0810bd9aa63b796dbc -r 085883326638467e244499fb4c781452ad850548 setup.py --- a/setup.py +++ b/setup.py @@ -8,6 +8,10 @@ long_description = open("README.rst").read() def main(): + install_requires = ["py>=1.4.15"] + if sys.version_info < (2,7): + install_requires.append("argparse") + setup( name='pytest', description='py.test: simple powerful testing with Python', @@ -21,7 +25,7 @@ entry_points= make_entry_points(), cmdclass = {'test': PyTest}, # the following should be enabled for release - install_requires=['py>=1.4.14'], + install_requires=install_requires, classifiers=['Development Status :: 6 - Mature', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', diff -r 31bc337af337227d596eff0810bd9aa63b796dbc -r 085883326638467e244499fb4c781452ad850548 testing/conftest.py --- a/testing/conftest.py +++ b/testing/conftest.py @@ -77,6 +77,9 @@ 'python2.5': r'C:\Python25\python.exe', 'python2.4': r'C:\Python24\python.exe', 'python3.1': r'C:\Python31\python.exe', + 'python3.2': r'C:\Python32\python.exe', + 'python3.3': r'C:\Python33\python.exe', + 'python3.4': r'C:\Python34\python.exe', } def getexecutable(name, cache={}): diff -r 31bc337af337227d596eff0810bd9aa63b796dbc -r 085883326638467e244499fb4c781452ad850548 testing/test_genscript.py --- a/testing/test_genscript.py +++ b/testing/test_genscript.py @@ -1,10 +1,11 @@ +import pytest import py, os, sys import subprocess -def pytest_funcarg__standalone(request): - return request.cached_setup(scope="module", - setup=lambda: Standalone(request)) +@pytest.fixture(scope="module") +def standalone(request): + return Standalone(request) class Standalone: def __init__(self, request): @@ -20,6 +21,12 @@ return testdir._run(anypython, self.script, *args) def test_gen(testdir, anypython, standalone): + if sys.version_info >= (2,7): + result = testdir._run(anypython, "-c", + "import sys;print sys.version_info >=(2,7)") + if result.stdout.str() == "False": + pytest.skip("genscript called from python2.7 cannot work " + "earlier python versions") result = standalone.run(anypython, testdir, '--version') assert result.ret == 0 result.stderr.fnmatch_lines([ diff -r 31bc337af337227d596eff0810bd9aa63b796dbc -r 085883326638467e244499fb4c781452ad850548 testing/test_parseopt.py --- a/testing/test_parseopt.py +++ b/testing/test_parseopt.py @@ -1,3 +1,4 @@ +from __future__ import with_statement import py, pytest from _pytest import config as parseopt from textwrap import dedent @@ -44,7 +45,7 @@ res = argument.attrs() assert res['default'] == 42 assert res['dest'] == 'abc' - + def test_group_add_and_get(self): parser = parseopt.Parser() group = parser.getgroup("hello", description="desc") @@ -128,7 +129,7 @@ x = parser.addoption("--ultimate-answer", type=int) args = parser.parse(['--ultimate-answer', '42']) assert args.ultimate_answer == 42 - + def test_parse_defaultgetter(self): def defaultget(option): if not hasattr(option, 'type'): 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