From py-svn at codespeak.net Fri Sep 2 17:02:21 2011 From: py-svn at codespeak.net (Rolex.com) Date: Fri, 2 Sep 2011 17:02:21 +0200 (CEST) Subject: py-svn@codespeak.net Rolex ® Official Site 03% 0FF! Message-ID: <20110902150221.813F72A2031@codespeak.net> An HTML attachment was scrubbed... URL: From commits-noreply at bitbucket.org Tue Sep 6 20:12:50 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Tue, 06 Sep 2011 18:12:50 -0000 Subject: [py-svn] commit/pytest: deeplook: Capitalised start of headlines, added -ing to a few headlines. Message-ID: <20110906181250.21520.6478@bitbucket01.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/7d983a8aa4a7/ changeset: 7d983a8aa4a7 user: deeplook date: 2011-09-06 11:43:42 summary: Capitalised start of headlines, added -ing to a few headlines. affected #: 22 files (31 bytes) --- a/doc/assert.txt Tue Aug 30 10:34:21 2011 -0400 +++ b/doc/assert.txt Tue Sep 06 11:43:42 2011 +0200 @@ -4,7 +4,7 @@ .. _`assert with the assert statement`: -assert with the ``assert`` statement +Asserting with the ``assert`` statement --------------------------------------------------------- ``py.test`` allows you to use the standard python ``assert`` for verifying @@ -54,7 +54,7 @@ See :ref:`assert-details` for more information on assertion introspection. -assertions about expected exceptions +Assertions about expected exceptions ------------------------------------------ In order to write assertions about raised exceptions, you can use --- a/doc/builtin.txt Tue Aug 30 10:34:21 2011 -0400 +++ b/doc/builtin.txt Tue Sep 06 11:43:42 2011 +0200 @@ -1,7 +1,7 @@ .. _`pytest helpers`: -pytest builtin helpers +Pytest builtin helpers ================================================ builtin pytest.* functions and helping objects @@ -17,7 +17,7 @@ .. automodule:: pytest :members: -builtin function arguments +Builtin function arguments ----------------------------------------------------- You can ask for available builtin or project-custom --- a/doc/customize.txt Tue Aug 30 10:34:21 2011 -0400 +++ b/doc/customize.txt Tue Sep 06 11:43:42 2011 +0200 @@ -1,4 +1,4 @@ -basic test configuration +Basic test configuration =================================== Command line options and configuration file settings @@ -59,7 +59,7 @@ From now on, running ``py.test`` will add the specified options. -builtin configuration file options +Builtin configuration file options ---------------------------------------------- .. confval:: minversion --- a/doc/doctest.txt Tue Aug 30 10:34:21 2011 -0400 +++ b/doc/doctest.txt Tue Sep 06 11:43:42 2011 +0200 @@ -1,5 +1,5 @@ -doctest integration for modules and test files +Doctest integration for modules and test files ========================================================= By default all files matching the ``test*.txt`` pattern will --- a/doc/example/mysetup.txt Tue Aug 30 10:34:21 2011 -0400 +++ b/doc/example/mysetup.txt Tue Sep 06 11:43:42 2011 +0200 @@ -3,7 +3,7 @@ .. _mysetup: -mysetup pattern: application specific test fixtures +Mysetup pattern: application specific test fixtures ========================================================== Here is a basic useful step-by-step example for managing and interacting @@ -12,8 +12,8 @@ configuring application objects and allow test modules and test functions to stay ignorant of involved details. -step1: implementing the test/app-specific ``mysetup`` pattern -------------------------------------------------------------- +Step 1: Implementing the test/app-specific ``mysetup`` pattern +-------------------------------------------------------------- Let's write a simple test function using a ``mysetup`` funcarg:: @@ -76,7 +76,7 @@ .. _here: http://uncyclopedia.wikia.com/wiki/The_Hitchhiker's_Guide_to_the_Galaxy .. _`tut-cmdlineoption`: -step 2: checking a command line option and skipping tests +Step 2: Checking a command line option and skipping tests ----------------------------------------------------------- To add a command line option we update the ``conftest.py`` of --- a/doc/example/nonpython.txt Tue Aug 30 10:34:21 2011 -0400 +++ b/doc/example/nonpython.txt Tue Sep 06 11:43:42 2011 +0200 @@ -6,7 +6,7 @@ .. _`yaml plugin`: -a basic example for specifying tests in Yaml files +A basic example for specifying tests in Yaml files -------------------------------------------------------------- .. _`pytest-yamlwsgi`: http://bitbucket.org/aafshar/pytest-yamlwsgi/src/tip/pytest_yamlwsgi.py --- a/doc/example/parametrize.txt Tue Aug 30 10:34:21 2011 -0400 +++ b/doc/example/parametrize.txt Tue Sep 06 11:43:42 2011 +0200 @@ -1,14 +1,14 @@ .. _paramexamples: -parametrizing tests +Parametrizing tests ================================================= py.test allows to easily implement your own custom parametrization scheme for tests. Here we provide some examples for inspiration and re-use. -generating parameters combinations, depending on command line +Generating parameters combinations, depending on command line ---------------------------------------------------------------------------- .. regendoc:wipe @@ -272,7 +272,7 @@ test_parametrize2.py:23: Failed 2 failed, 2 passed in 0.02 seconds -checking serialization between Python interpreters +Checking serialization between Python interpreters -------------------------------------------------------------- Here is a stripped down real-life example of using parametrized --- a/doc/example/pythoncollection.txt Tue Aug 30 10:34:21 2011 -0400 +++ b/doc/example/pythoncollection.txt Tue Sep 06 11:43:42 2011 +0200 @@ -1,7 +1,7 @@ Changing standard (Python) test discovery =============================================== -changing directory recursion +Changing directory recursion ----------------------------------------------------- You can set the :confval:`norecursedirs` option in an ini-file, for example your ``setup.cfg`` in the project root directory:: @@ -14,7 +14,7 @@ .. _`change naming conventions`: -change naming conventions +Changing naming conventions ----------------------------------------------------- You can configure different naming conventions by setting @@ -53,7 +53,7 @@ ============================= in 0.01 seconds ============================= -interpret cmdline arguments as Python packages +Interpreting cmdline arguments as Python packages ----------------------------------------------------- You can use the ``--pyargs`` option to make py.test try @@ -75,7 +75,7 @@ if NAME exists as an importable package/module and otherwise treat it as a filesystem path. -finding out what is collected +Finding out what is collected ----------------------------------------------- You can always peek at the collection tree without running tests like this:: --- a/doc/example/simple.txt Tue Aug 30 10:34:21 2011 -0400 +++ b/doc/example/simple.txt Tue Sep 06 11:43:42 2011 +0200 @@ -1,10 +1,10 @@ .. highlightlang:: python -basic patterns and examples +Basic patterns and examples ========================================================== -pass different values to a test function, depending on command line options +Pass different values to a test function, depending on command line options ---------------------------------------------------------------------------- .. regendoc:wipe @@ -85,7 +85,7 @@ on real-life examples. -dynamically adding command line options +Dynamically adding command line options -------------------------------------------------------------- .. regendoc:wipe @@ -119,7 +119,7 @@ .. _`excontrolskip`: -control skipping of tests according to command line option +Control skipping of tests according to command line option -------------------------------------------------------------- .. regendoc:wipe @@ -176,7 +176,7 @@ ========================= 2 passed in 0.01 seconds ========================= -writing well integrated assertion helpers +Writing well integrated assertion helpers -------------------------------------------------- .. regendoc:wipe --- a/doc/faq.txt Tue Aug 30 10:34:21 2011 -0400 +++ b/doc/faq.txt Tue Sep 06 11:43:42 2011 +0200 @@ -63,7 +63,7 @@ .. _`py/__init__.py`: http://bitbucket.org/hpk42/py-trunk/src/trunk/py/__init__.py -function arguments, parametrized tests and setup +Function arguments, parametrized tests and setup ------------------------------------------------------- .. _funcargs: test/funcargs.html --- a/doc/getting-started.txt Tue Aug 30 10:34:21 2011 -0400 +++ b/doc/getting-started.txt Tue Sep 06 11:43:42 2011 +0200 @@ -182,7 +182,7 @@ py.test --funcargs # shows builtin and custom function arguments -where to go next +Where to go next ------------------------------------- Here are a few suggestions where to go next: --- a/doc/mark.txt Tue Aug 30 10:34:21 2011 -0400 +++ b/doc/mark.txt Tue Sep 06 11:43:42 2011 +0200 @@ -1,7 +1,7 @@ .. _mark: -mark test functions with attributes +Marking test functions with attributes ================================================================= .. currentmodule:: _pytest.mark --- a/doc/monkeypatch.txt Tue Aug 30 10:34:21 2011 -0400 +++ b/doc/monkeypatch.txt Tue Sep 06 11:43:42 2011 +0200 @@ -1,5 +1,5 @@ -monkeypatching/mocking modules and environments +Monkeypatching/mocking modules and environments ================================================================ .. currentmodule:: _pytest.monkeypatch --- a/doc/nose.txt Tue Aug 30 10:34:21 2011 -0400 +++ b/doc/nose.txt Tue Sep 06 11:43:42 2011 +0200 @@ -1,4 +1,4 @@ -Running test written for nose +Running tests written for nose ======================================= .. include:: links.inc --- a/doc/plugins.txt Tue Aug 30 10:34:21 2011 -0400 +++ b/doc/plugins.txt Tue Sep 06 11:43:42 2011 +0200 @@ -203,7 +203,7 @@ .. _`cmdunregister`: -deactivate / unregister a plugin by name +Deactivating / unregistering a plugin by name ---------------------------------------------------------------------------- You can prevent plugins from loading or unregister them:: @@ -253,7 +253,7 @@ py.test hook reference ==================================== -hook specification and validation +Hook specification and validation ----------------------------------------- py.test calls hook functions to implement initialization, running, @@ -264,7 +264,7 @@ by simply not specifying them. If you mistype argument names or the hook name itself you get an error showing the available arguments. -initialisation, command line and configuration hooks +Initialisation, command line and configuration hooks -------------------------------------------------------------------- .. currentmodule:: _pytest.hookspec @@ -277,7 +277,7 @@ .. autofunction:: pytest_configure .. autofunction:: pytest_unconfigure -generic "runtest" hooks +Generic "runtest" hooks ------------------------------ All all runtest related hooks receive a :py:class:`pytest.Item` object. @@ -297,7 +297,7 @@ The :py:mod:`_pytest.terminal` reported specifically uses the reporting hook to print information about a test run. -collection hooks +Collection hooks ------------------------------ py.test calls the following hooks for collecting files and directories: @@ -312,7 +312,7 @@ .. autofunction:: pytest_pycollect_makeitem -reporting hooks +Reporting hooks ------------------------------ Session related reporting hooks: --- a/doc/recwarn.txt Tue Aug 30 10:34:21 2011 -0400 +++ b/doc/recwarn.txt Tue Sep 06 11:43:42 2011 +0200 @@ -1,8 +1,8 @@ -asserting deprecation and other warnings. +Asserting deprecation and other warnings. ===================================================== -recwarn function argument +The recwarn function argument ------------------------------------ You can use the ``recwarn`` funcarg to assert that code triggers @@ -24,7 +24,7 @@ * ``pop(category=None)``: return last warning matching the category. * ``clear()``: clear list of warnings -ensuring a function triggers a deprecation warning +Ensuring a function triggers a deprecation warning ------------------------------------------------------- You can also call a global helper for checking --- a/doc/skipping.txt Tue Aug 30 10:34:21 2011 -0400 +++ b/doc/skipping.txt Tue Sep 06 11:43:42 2011 +0200 @@ -1,6 +1,6 @@ .. _`skip and xfail`: -skip and xfail: dealing with tests that can not succeed +Skip and xfail: dealing with tests that can not succeed ===================================================================== If you have test functions that cannot be run on certain platforms @@ -62,7 +62,7 @@ def test_function(): ... -skip all test functions of a class +Skip all test functions of a class -------------------------------------- As with all function :ref:`marking ` you can skip test functions at the @@ -92,7 +92,7 @@ .. _xfail: -mark a test function as expected to fail +Mark a test function as expected to fail ------------------------------------------------------- You can use the ``xfail`` marker to indicate that you @@ -151,7 +151,7 @@ .. _`evaluation of skipif/xfail conditions`: -evaluation of skipif/xfail expressions +Evaluation of skipif/xfail expressions ---------------------------------------------------- .. versionadded:: 2.0.2 @@ -174,7 +174,7 @@ ... -imperative xfail from within a test or setup function +Imperative xfail from within a test or setup function ------------------------------------------------------ If you cannot declare xfail-conditions at import time @@ -186,7 +186,7 @@ pytest.xfail("unsupported configuration") -skipping on a missing import dependency +Skipping on a missing import dependency -------------------------------------------------- You can use the following import helper at module level @@ -202,7 +202,7 @@ The version will be read from the specified module's ``__version__`` attribute. -imperative skip from within a test or setup function +Imperative skip from within a test or setup function ------------------------------------------------------ If for some reason you cannot declare skip-conditions --- a/doc/talks.txt Tue Aug 30 10:34:21 2011 -0400 +++ b/doc/talks.txt Tue Sep 06 11:43:42 2011 +0200 @@ -4,40 +4,40 @@ .. _`funcargs`: funcargs.html -tutorial examples and blog postings +Tutorial examples and blog postings --------------------------------------------- .. _`tutorial1 repository`: http://bitbucket.org/hpk42/pytest-tutorial1/ .. _`pycon 2010 tutorial PDF`: http://bitbucket.org/hpk42/pytest-tutorial1/raw/tip/pytest-basic.pdf -basic usage and funcargs: +Basic usage and funcargs: - `pycon 2010 tutorial PDF`_ and `tutorial1 repository`_ -function arguments: +Function arguments: - :ref:`mysetup` - `application setup in test functions with funcargs`_ - `monkey patching done right`_ (blog post, consult `monkeypatch plugin`_ for actual 1.0 API) -test parametrization: +Test parametrization: - `generating parametrized tests with funcargs`_ - `test generators and cached setup`_ - `parametrizing tests, generalized`_ (blog post) - `putting test-hooks into local or global plugins`_ (blog post) -assertion introspection +Assertion introspection: - `(07/2011) Behind the scenes of py.test's new assertion rewriting `_ -distributed testing: +Distributed testing: - `simultaneously test your code on all platforms`_ (blog entry) -plugin specific examples: +Plugin specific examples: - `skipping slow tests by default in py.test`_ (blog entry) @@ -54,7 +54,7 @@ .. _`generating parametrized tests with funcargs`: funcargs.html#test-generators .. _`test generators and cached setup`: http://bruynooghe.blogspot.com/2010/06/pytest-test-generators-and-cached-setup.html -conference talks and tutorials +Conference talks and tutorials ---------------------------------------- - `ep2009-rapidtesting.pdf`_ tutorial slides (July 2009): --- a/doc/tmpdir.txt Tue Aug 30 10:34:21 2011 -0400 +++ b/doc/tmpdir.txt Tue Sep 06 11:43:42 2011 +0200 @@ -1,10 +1,10 @@ .. _`tmpdir handling`: -temporary directories and files +Temporary directories and files ================================================ -the 'tmpdir' test function argument +The 'tmpdir' test function argument ----------------------------------- You can use the ``tmpdir`` function argument which will @@ -51,7 +51,7 @@ .. _`base temporary directory`: -the default base temporary directory +The default base temporary directory ----------------------------------------------- Temporary directories are by default created as sub-directories of --- a/doc/unittest.txt Tue Aug 30 10:34:21 2011 -0400 +++ b/doc/unittest.txt Tue Sep 06 11:43:42 2011 +0200 @@ -1,7 +1,7 @@ .. _`unittest.TestCase`: -unittest.TestCase support +Support for unittest.TestCase ===================================================================== py.test has limited support for running Python `unittest.py style`_ tests. --- a/doc/usage.txt Tue Aug 30 10:34:21 2011 -0400 +++ b/doc/usage.txt Tue Sep 06 11:43:42 2011 +0200 @@ -7,7 +7,7 @@ .. _cmdline: -calling pytest through ``python -m pytest`` +Calling pytest through ``python -m pytest`` ----------------------------------------------------- .. versionadded:: 2.0 @@ -38,7 +38,7 @@ py.test -x # stop after first failure py.test -maxfail=2 # stop after two failures -specifying tests / selecting tests +Specifying tests / selecting tests --------------------------------------------------- Several test run options:: @@ -98,7 +98,7 @@ In previous versions you could only enter PDB tracing if you disable capturing on the command line via ``py.test -s``. -creating JUnitXML format files +Creating JUnitXML format files ---------------------------------------------------- To create result files which can be read by Hudson_ or other Continuous @@ -108,7 +108,7 @@ to create an XML file at ``path``. -creating resultlog format files +Creating resultlog format files ---------------------------------------------------- To create plain-text machine-readable result files you can issue:: @@ -121,7 +121,7 @@ .. _`PyPy-test`: http://codespeak.net:8099/summary -send test report to pocoo pastebin service +Sending test report to pocoo pastebin service ----------------------------------------------------- **Creating a URL for each test failure**:: @@ -138,7 +138,7 @@ Currently only pasting to the http://paste.pocoo.org service is implemented. -calling pytest from Python code +Calling pytest from Python code ---------------------------------------------------- .. versionadded:: 2.0 --- a/doc/xunit_setup.txt Tue Aug 30 10:34:21 2011 -0400 +++ b/doc/xunit_setup.txt Tue Sep 06 11:43:42 2011 +0200 @@ -1,7 +1,7 @@ .. _xunitsetup: ==================================== -extended xUnit style setup fixtures +Extended xUnit style setup fixtures ==================================== .. _`funcargs`: funcargs.html @@ -16,7 +16,7 @@ handling by optionally calling per-module and per-class hooks. -module level setup/teardown +Module level setup/teardown ============================================= If you have multiple test functions and test classes in a single @@ -33,7 +33,7 @@ with a setup_module method. """ -class level setup/teardown +Class level setup/teardown ============================================= Similarly, the following methods are called at class level before @@ -51,7 +51,7 @@ with a call to setup_class. """ -method and function level setup/teardown +Method and function level setup/teardown ============================================= Similarly, the following methods are called around each method invocation:: 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. From commits-noreply at bitbucket.org Mon Sep 12 08:58:29 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Mon, 12 Sep 2011 06:58:29 -0000 Subject: [py-svn] commit/pytest: 4 new changesets Message-ID: <20110912065829.32677.45816@bitbucket02.managed.contegix.com> 4 new changesets in pytest: http://bitbucket.org/hpk42/pytest/changeset/e083d790bf52/ changeset: e083d790bf52 user: segfaulthunter date: 2011-09-01 16:19:16 summary: Improve --pyargs. Don't evaluate modules and do nto show 'module not found' if ImportError is thrown in the module. affected #: 1 file (166 bytes) --- a/_pytest/main.py Tue Aug 30 10:34:21 2011 -0400 +++ b/_pytest/main.py Thu Sep 01 16:19:16 2011 +0200 @@ -2,7 +2,7 @@ import py import pytest, _pytest -import os, sys +import os, sys, imp tracebackcutdir = py.path.local(_pytest.__file__).dirpath() # exitcodes for the command line @@ -469,16 +469,22 @@ return True def _tryconvertpyarg(self, x): - try: - mod = __import__(x, None, None, ['__doc__']) - except (ValueError, ImportError): - return x - p = py.path.local(mod.__file__) - if p.purebasename == "__init__": - p = p.dirpath() - else: - p = p.new(basename=p.purebasename+".py") - return str(p) + mod = None + path = [os.path.abspath('.')] + sys.path + for name in x.split('.'): + try: + fd, mod, type_ = imp.find_module(name, path) + except ImportError: + return x + else: + if fd is not None: + fd.close() + + if type_[2] != imp.PKG_DIRECTORY: + path = [os.path.dirname(mod)] + else: + path = [mod] + return mod def _parsearg(self, arg): """ return (fspath, names) tuple after checking the file exists. """ http://bitbucket.org/hpk42/pytest/changeset/9b98f2644f77/ changeset: 9b98f2644f77 user: segfaulthunter date: 2011-09-05 17:38:22 summary: Add acceptance test for new --pyargs behavior. affected #: 1 file (405 bytes) --- a/testing/acceptance_test.py Thu Sep 01 16:19:16 2011 +0200 +++ b/testing/acceptance_test.py Mon Sep 05 17:38:22 2011 +0200 @@ -374,6 +374,17 @@ out, err = capsys.readouterr() assert "--myopt" in out + def test_pyargs_importerror(self, testdir, monkeypatch): + monkeypatch.delenv('PYTHONDONTWRITEBYTECODE', False) + path = testdir.mkpydir("tpkg") + path.join("test_hello.py").write('raise ImportError') + + result = testdir.runpytest("--pyargs", "tpkg.test_hello") + assert result.ret != 0 + result.stdout.fnmatch_lines([ + "*collected 0 items*" + ]) + def test_cmdline_python_package(self, testdir, monkeypatch): monkeypatch.delenv('PYTHONDONTWRITEBYTECODE', False) path = testdir.mkpydir("tpkg") http://bitbucket.org/hpk42/pytest/changeset/7e4fd7450dca/ changeset: 7e4fd7450dca user: segfaulthunter date: 2011-09-05 22:01:50 summary: Add FIXME. affected #: 1 file (101 bytes) --- a/testing/acceptance_test.py Mon Sep 05 17:38:22 2011 +0200 +++ b/testing/acceptance_test.py Mon Sep 05 22:01:50 2011 +0200 @@ -381,6 +381,8 @@ result = testdir.runpytest("--pyargs", "tpkg.test_hello") assert result.ret != 0 + # FIXME: It would be more natural to match NOT + # "ERROR*file*or*package*not*found*". result.stdout.fnmatch_lines([ "*collected 0 items*" ]) http://bitbucket.org/hpk42/pytest/changeset/c5970c0783c2/ changeset: c5970c0783c2 user: hpk42 date: 2011-09-12 08:57:35 summary: merge, bump version affected #: 5 files (746 bytes) --- a/CHANGELOG Tue Sep 06 11:43:42 2011 +0200 +++ b/CHANGELOG Mon Sep 12 08:57:35 2011 +0200 @@ -1,6 +1,7 @@ Changes between 2.1.1 and [NEXT VERSION] ---------------------------------------- +- refine test discovery by package/module name (--pyargs), thanks Florian Mayer - fix issue69 / assertion rewriting fixed on some boolean operations - fix issue68 / packages now work with assertion rewriting - fix issue66: use different assertion rewriting caches when the -O option is passed --- a/_pytest/__init__.py Tue Sep 06 11:43:42 2011 +0200 +++ b/_pytest/__init__.py Mon Sep 12 08:57:35 2011 +0200 @@ -1,2 +1,2 @@ # -__version__ = '2.1.1' +__version__ = '2.1.2.dev1' --- a/_pytest/main.py Tue Sep 06 11:43:42 2011 +0200 +++ b/_pytest/main.py Mon Sep 12 08:57:35 2011 +0200 @@ -2,7 +2,7 @@ import py import pytest, _pytest -import os, sys +import os, sys, imp tracebackcutdir = py.path.local(_pytest.__file__).dirpath() # exitcodes for the command line @@ -469,16 +469,22 @@ return True def _tryconvertpyarg(self, x): - try: - mod = __import__(x, None, None, ['__doc__']) - except (ValueError, ImportError): - return x - p = py.path.local(mod.__file__) - if p.purebasename == "__init__": - p = p.dirpath() - else: - p = p.new(basename=p.purebasename+".py") - return str(p) + mod = None + path = [os.path.abspath('.')] + sys.path + for name in x.split('.'): + try: + fd, mod, type_ = imp.find_module(name, path) + except ImportError: + return x + else: + if fd is not None: + fd.close() + + if type_[2] != imp.PKG_DIRECTORY: + path = [os.path.dirname(mod)] + else: + path = [mod] + return mod def _parsearg(self, arg): """ return (fspath, names) tuple after checking the file exists. """ --- a/setup.py Tue Sep 06 11:43:42 2011 +0200 +++ b/setup.py Mon Sep 12 08:57:35 2011 +0200 @@ -24,7 +24,7 @@ name='pytest', description='py.test: simple powerful testing with Python', long_description = long_description, - version='2.1.1', + version='2.1.2.dev1', url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], --- a/testing/acceptance_test.py Tue Sep 06 11:43:42 2011 +0200 +++ b/testing/acceptance_test.py Mon Sep 12 08:57:35 2011 +0200 @@ -231,7 +231,7 @@ res = testdir.runpytest(p) assert res.ret == 0 res.stdout.fnmatch_lines(["*1 skipped*"]) - + def test_direct_addressing_selects(self, testdir): p = testdir.makepyfile(""" def pytest_generate_tests(metafunc): @@ -364,7 +364,7 @@ retcode = testdir.pytestmain(testdir.tmpdir) assert not retcode out, err = capsys.readouterr() - + def test_invoke_plugin_api(self, capsys): class MyPlugin: def pytest_addoption(self, parser): @@ -374,6 +374,19 @@ out, err = capsys.readouterr() assert "--myopt" in out + def test_pyargs_importerror(self, testdir, monkeypatch): + monkeypatch.delenv('PYTHONDONTWRITEBYTECODE', False) + path = testdir.mkpydir("tpkg") + path.join("test_hello.py").write('raise ImportError') + + result = testdir.runpytest("--pyargs", "tpkg.test_hello") + assert result.ret != 0 + # FIXME: It would be more natural to match NOT + # "ERROR*file*or*package*not*found*". + result.stdout.fnmatch_lines([ + "*collected 0 items*" + ]) + def test_cmdline_python_package(self, testdir, monkeypatch): monkeypatch.delenv('PYTHONDONTWRITEBYTECODE', False) path = testdir.mkpydir("tpkg") 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. From commits-noreply at bitbucket.org Tue Sep 20 23:53:13 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Tue, 20 Sep 2011 21:53:13 -0000 Subject: [py-svn] commit/pytest: gutworth: rewrite file newlines when the python parser is picky Message-ID: <20110920215313.4728.59568@bitbucket01.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/a7e4bf1c36af/ changeset: a7e4bf1c36af user: gutworth date: 2011-09-20 23:53:07 summary: rewrite file newlines when the python parser is picky affected #: 3 files (-1 bytes) --- a/CHANGELOG Mon Sep 12 08:57:35 2011 +0200 +++ b/CHANGELOG Tue Sep 20 17:53:07 2011 -0400 @@ -1,6 +1,7 @@ Changes between 2.1.1 and [NEXT VERSION] ---------------------------------------- +- fix assertion rewriting on files with windows newlines on some Python versions - refine test discovery by package/module name (--pyargs), thanks Florian Mayer - fix issue69 / assertion rewriting fixed on some boolean operations - fix issue68 / packages now work with assertion rewriting --- a/_pytest/assertion/rewrite.py Mon Sep 12 08:57:35 2011 +0200 +++ b/_pytest/assertion/rewrite.py Tue Sep 20 17:53:07 2011 -0400 @@ -38,6 +38,8 @@ PYC_EXT = ".py" + "c" if __debug__ else "o" PYC_TAIL = "." + PYTEST_TAG + PYC_EXT +REWRITE_NEWLINES = sys.version_info[:2] != (2, 7) and sys.version_info < (3, 2) + class AssertionRewritingHook(object): """Import hook which rewrites asserts.""" @@ -181,12 +183,19 @@ fp.close() return True +RN = "\r\n".encode("utf-8") +N = "\n".encode("utf-8") + def _rewrite_test(state, fn): """Try to read and rewrite *fn* and return the code object.""" try: source = fn.read("rb") except EnvironmentError: return None + # On Python versions which are not 2.7 and less than or equal to 3.1, the + # parser expects *nix newlines. + if REWRITE_NEWLINES: + source = source.replace(RN, N) + N try: tree = ast.parse(source) except SyntaxError: --- a/testing/test_assertrewrite.py Mon Sep 12 08:57:35 2011 +0200 +++ b/testing/test_assertrewrite.py Tue Sep 20 17:53:07 2011 -0400 @@ -357,3 +357,9 @@ def test_rewritten(): assert "@py_builtins" in globals()""") assert testdir.runpytest().ret == 0 + + def test_translate_newlines(self, testdir): + content = "def test_rewritten():\r\n assert '@py_builtins' in globals()" + b = content.encode("utf-8") + testdir.tmpdir.join("test_newlines.py").write(b, "wb") + assert testdir.runpytest().ret == 0 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. From commits-noreply at bitbucket.org Wed Sep 21 06:21:58 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Wed, 21 Sep 2011 04:21:58 -0000 Subject: [py-svn] commit/pytest: hpk42: relax error string matching Message-ID: <20110921042158.2155.68605@bitbucket03.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/15184cd09cb9/ changeset: 15184cd09cb9 user: hpk42 date: 2011-09-21 06:21:48 summary: relax error string matching affected #: 1 file (-1 bytes) --- a/testing/acceptance_test.py Tue Sep 20 17:53:07 2011 -0400 +++ b/testing/acceptance_test.py Wed Sep 21 06:21:48 2011 +0200 @@ -411,7 +411,7 @@ result = testdir.runpytest("--pyargs", "tpkg.test_hello") assert result.ret != 0 result.stderr.fnmatch_lines([ - "*file*not*found*test_hello*", + "*not*found*test_hello*", ]) def test_cmdline_python_package_not_exists(self, testdir): 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. From commits-noreply at bitbucket.org Wed Sep 21 06:45:52 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Wed, 21 Sep 2011 04:45:52 -0000 Subject: [py-svn] commit/pytest: hpk42: don't try assertion rewriting on jython for now Message-ID: <20110921044552.27843.4724@bitbucket13.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/0dcf96067a0a/ changeset: 0dcf96067a0a user: hpk42 date: 2011-09-21 06:45:40 summary: don't try assertion rewriting on jython for now affected #: 4 files (-1 bytes) --- a/CHANGELOG Wed Sep 21 06:21:48 2011 +0200 +++ b/CHANGELOG Wed Sep 21 06:45:40 2011 +0200 @@ -6,6 +6,7 @@ - fix issue69 / assertion rewriting fixed on some boolean operations - fix issue68 / packages now work with assertion rewriting - fix issue66: use different assertion rewriting caches when the -O option is passed +- don't try assertion rewriting on Jython, use reinterp Changes between 2.1.0 and 2.1.1 ---------------------------------------------- --- a/_pytest/__init__.py Wed Sep 21 06:21:48 2011 +0200 +++ b/_pytest/__init__.py Wed Sep 21 06:45:40 2011 +0200 @@ -1,2 +1,2 @@ # -__version__ = '2.1.2.dev1' +__version__ = '2.1.2.dev2' --- a/_pytest/assertion/__init__.py Wed Sep 21 06:21:48 2011 +0200 +++ b/_pytest/assertion/__init__.py Wed Sep 21 06:45:40 2011 +0200 @@ -38,6 +38,9 @@ import ast except ImportError: mode = "reinterp" + else: + if sys.platform.startswith('java'): + mode = "reinterp" if mode != "plain": _load_modules(mode) def callbinrepr(op, left, right): --- a/setup.py Wed Sep 21 06:21:48 2011 +0200 +++ b/setup.py Wed Sep 21 06:45:40 2011 +0200 @@ -24,7 +24,7 @@ name='pytest', description='py.test: simple powerful testing with Python', long_description = long_description, - version='2.1.2.dev1', + version='2.1.2.dev2', url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], 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. From commits-noreply at bitbucket.org Wed Sep 21 07:52:53 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Wed, 21 Sep 2011 05:52:53 -0000 Subject: [py-svn] commit/pytest: hpk42: quick review of issues Message-ID: <20110921055253.2154.42311@bitbucket03.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/ecc2297b5e2a/ changeset: ecc2297b5e2a user: hpk42 date: 2011-09-21 07:52:41 summary: quick review of issues affected #: 1 file (-1 bytes) --- a/ISSUES.txt Wed Sep 21 06:45:40 2011 +0200 +++ b/ISSUES.txt Wed Sep 21 07:52:41 2011 +0200 @@ -20,7 +20,7 @@ do early-teardown of test modules ----------------------------------------- -tags: feature 2.1 +tags: feature 2.2 currently teardowns are called when the next tests is setup except for the function/method level where interally @@ -32,7 +32,7 @@ consider and document __init__ file usage in test directories --------------------------------------------------------------- -tags: bug 2.1 core +tags: bug 2.2 core Currently, a test module is imported with its fully qualified package path, determined by checking __init__ files upwards. @@ -47,7 +47,7 @@ relax requirement to have tests/testing contain an __init__ ---------------------------------------------------------------- -tags: feature 2.1 +tags: feature 2.2 bb: http://bitbucket.org/hpk42/py-trunk/issue/64 A local test run of a "tests" directory may work @@ -58,25 +58,24 @@ customize test function collection ------------------------------------------------------- -tags: feature 2.1 +tags: feature 2.2 - introduce py.test.mark.nocollect for not considering a function for test collection at all. maybe also introduce a py.test.mark.test to explicitely mark a function to become a tested one. Lookup JUnit ways of tagging tests. -- allow an easy way to customize "test_", "Test" prefixes for file paths - and test function/class names. the current customizable Item requires - too much code/concepts to influence this collection matching. - maybe introduce pytest_pycollect_filters = { - 'file': 'test*.py', - 'function': 'test*', - 'class': 'Test*', - } +introduce pytest.mark.importorskip +------------------------------------------------------- +tags: feature 2.2 + +in addition to the imperative pytest.importorskip also introduce +a pytest.mark.importorskip so that the test count is more correct. + introduce py.test.mark.platform ------------------------------------------------------- -tags: feature 2.1 +tags: feature 2.2 Introduce nice-to-spell platform-skipping, examples: @@ -93,7 +92,7 @@ pytest.mark.xfail signature change ------------------------------------------------------- -tags: feature 2.1 +tags: feature 2.2 change to pytest.mark.xfail(reason, (optional)condition) to better implement the word meaning. It also signals @@ -103,7 +102,7 @@ introduce py.test.mark registration ----------------------------------------- -tags: feature 2.1 +tags: feature 2.2 introduce a hook that allows to register a named mark decorator with documentation and add "py.test --marks" to get @@ -112,7 +111,7 @@ allow to non-intrusively apply skipfs/xfail/marks --------------------------------------------------- -tags: feature 2.1 +tags: feature 2.2 use case: mark a module or directory structures to be skipped on certain platforms (i.e. no import @@ -123,14 +122,14 @@ explicit referencing of conftest.py files ----------------------------------------- -tags: feature 2.1 +tags: feature 2.2 allow to name conftest.py files (in sub directories) that should be imported early, as to include command line options. improve central py.test ini file ---------------------------------- -tags: feature 2.1 +tags: feature 2.2 introduce more declarative configuration options: - (to-be-collected test directories) @@ -141,7 +140,7 @@ new documentation ---------------------------------- -tags: feature 2.1 +tags: feature 2.2 - logo py.test - examples for unittest or functional testing @@ -152,7 +151,7 @@ generalize parametrized testing to generate combinations ------------------------------------------------------------- -tags: feature 2.1 +tags: feature 2.2 think about extending metafunc.addcall or add a new method to allow to generate tests with combinations of all generated versions - what to do @@ -167,7 +166,7 @@ have imported module mismatch honour relative paths -------------------------------------------------------- -tags: bug 2.1 +tags: bug 2.2 With 1.1.1 py.test fails at least on windows if an import is relative and compared against an absolute conftest.py @@ -175,7 +174,7 @@ call termination with small timeout ------------------------------------------------- -tags: feature 2.1 +tags: feature 2.2 test: testing/pytest/dist/test_dsession.py - test_terminate_on_hanging_node Call gateway group termination with a small timeout if available. @@ -183,7 +182,7 @@ consider globals: py.test.ensuretemp and config -------------------------------------------------------------- -tags: experimental-wish 2.1 +tags: experimental-wish 2.2 consider deprecating py.test.ensuretemp and py.test.config to further reduce py.test globality. Also consider @@ -192,7 +191,7 @@ consider allowing funcargs for setup methods -------------------------------------------------------------- -tags: experimental-wish 2.1 +tags: experimental-wish 2.2 Users have expressed the wish to have funcargs available to setup functions. Experiment with allowing funcargs there - it might @@ -208,7 +207,7 @@ consider pytest_addsyspath hook ----------------------------------------- -tags: 2.1 +tags: 2.2 py.test could call a new pytest_addsyspath() in order to systematically allow manipulation of sys.path and to inhibit it via --no-addsyspath @@ -220,7 +219,7 @@ show plugin information in test header ---------------------------------------------------------------- -tags: feature 2.1 +tags: feature 2.2 Now that external plugins are becoming more numerous it would be useful to have external plugins along with @@ -228,7 +227,7 @@ deprecate global py.test.config usage ---------------------------------------------------------------- -tags: feature 2.1 +tags: feature 2.2 py.test.ensuretemp and py.test.config are probably the last objects containing global state. Often using them is not @@ -238,7 +237,7 @@ remove deprecated bits in collect.py ------------------------------------------------------------------- -tags: feature 2.1 +tags: feature 2.2 In an effort to further simplify code, review and remove deprecated bits in collect.py. Probably good: 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. From commits-noreply at bitbucket.org Wed Sep 21 08:12:48 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Wed, 21 Sep 2011 06:12:48 -0000 Subject: [py-svn] commit/pytest: hpk42: try to make test suite pass on jython 2.5.1 again Message-ID: <20110921061248.27841.99683@bitbucket13.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/aa13be7382e9/ changeset: aa13be7382e9 user: hpk42 date: 2011-09-21 08:12:37 summary: try to make test suite pass on jython 2.5.1 again affected #: 4 files (-1 bytes) --- a/testing/acceptance_test.py Wed Sep 21 07:52:41 2011 +0200 +++ b/testing/acceptance_test.py Wed Sep 21 08:12:37 2011 +0200 @@ -281,6 +281,7 @@ result = testdir.runpython(p) assert result.ret == 0 + @pytest.mark.xfail("sys.platform.startswith('java')") def test_pydoc(self, testdir): for name in ('py.test', 'pytest'): result = testdir.runpython_c("import %s;help(%s)" % (name, name)) --- a/testing/test_assertion.py Wed Sep 21 07:52:41 2011 +0200 +++ b/testing/test_assertion.py Wed Sep 21 08:12:37 2011 +0200 @@ -235,7 +235,7 @@ "*test_traceback_failure.py:4: AssertionError" ]) - at pytest.mark.skipif("sys.version_info < (2,5) or '__pypy__' in sys.builtin_module_names") + at pytest.mark.skipif("sys.version_info < (2,5) or '__pypy__' in sys.builtin_module_names or sys.platform.startswith('java')" ) def test_warn_missing(testdir): p1 = testdir.makepyfile("") result = testdir.run(sys.executable, "-OO", "-m", "pytest", "-h") --- a/testing/test_assertrewrite.py Wed Sep 21 07:52:41 2011 +0200 +++ b/testing/test_assertrewrite.py Wed Sep 21 08:12:37 2011 +0200 @@ -4,6 +4,9 @@ import pytest ast = pytest.importorskip("ast") +if sys.platform.startswith("java"): + # XXX should be xfail + pytest.skip("assert rewrite does currently not work on jython") from _pytest.assertion import util from _pytest.assertion.rewrite import rewrite_asserts --- a/testing/test_conftest.py Wed Sep 21 07:52:41 2011 +0200 +++ b/testing/test_conftest.py Wed Sep 21 08:12:37 2011 +0200 @@ -89,7 +89,7 @@ assert value == 1.5 path = py.path.local(mod.__file__) assert path.dirpath() == basedir.join("adir", "b") - assert path.purebasename == "conftest" + assert path.purebasename.startswith("conftest") def test_conftest_in_nonpkg_with_init(tmpdir): tmpdir.ensure("adir-1.0/conftest.py").write("a=1 ; Directory = 3") 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. From py-svn at codespeak.net Wed Sep 21 13:39:05 2011 From: py-svn at codespeak.net (Rolex.com) Date: Wed, 21 Sep 2011 13:39:05 +0200 (CEST) Subject: [py-svn] Rolex For You Now -44% Message-ID: <$MESSAGE_ID> An HTML attachment was scrubbed... URL: From commits-noreply at bitbucket.org Fri Sep 23 07:30:53 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Fri, 23 Sep 2011 05:30:53 -0000 Subject: [py-svn] commit/pytest: hpk42: going for 2.1.2 bug fix release Message-ID: <20110923053053.17811.33739@bitbucket02.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/477f77a6ff1e/ changeset: 477f77a6ff1e user: hpk42 date: 2011-09-23 07:30:44 summary: going for 2.1.2 bug fix release affected #: 3 files (-1 bytes) --- a/CHANGELOG Wed Sep 21 08:12:37 2011 +0200 +++ b/CHANGELOG Fri Sep 23 07:30:44 2011 +0200 @@ -1,4 +1,4 @@ -Changes between 2.1.1 and [NEXT VERSION] +Changes between 2.1.1 and 2.1.2 ---------------------------------------- - fix assertion rewriting on files with windows newlines on some Python versions --- a/_pytest/__init__.py Wed Sep 21 08:12:37 2011 +0200 +++ b/_pytest/__init__.py Fri Sep 23 07:30:44 2011 +0200 @@ -1,2 +1,2 @@ # -__version__ = '2.1.2.dev2' +__version__ = '2.1.2' --- a/setup.py Wed Sep 21 08:12:37 2011 +0200 +++ b/setup.py Fri Sep 23 07:30:44 2011 +0200 @@ -24,7 +24,7 @@ name='pytest', description='py.test: simple powerful testing with Python', long_description = long_description, - version='2.1.2.dev2', + version='2.1.2', url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], 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. From commits-noreply at bitbucket.org Fri Sep 23 07:35:56 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Fri, 23 Sep 2011 05:35:56 -0000 Subject: [py-svn] commit/pytest: hpk42: make pip a bit more prominent now that it works on py3 Message-ID: <20110923053556.9263.54327@bitbucket13.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/819f8248e76a/ changeset: 819f8248e76a user: hpk42 date: 2011-09-23 07:35:47 summary: make pip a bit more prominent now that it works on py3 affected #: 1 file (-1 bytes) --- a/doc/getting-started.txt Fri Sep 23 07:30:44 2011 +0200 +++ b/doc/getting-started.txt Fri Sep 23 07:35:47 2011 +0200 @@ -16,8 +16,8 @@ Installation options:: - easy_install -U pytest # or - pip install -U pytest + pip install -U pytest # or + easy_install -U pytest To check your installation has installed the correct version:: @@ -200,10 +200,15 @@ easy_install or pip not found? ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -Consult `distribute docs`_ to install the ``easy_install`` -tool on your machine. You may also use the older -`setuptools`_ project but it lacks bug fixes and does not -work on Python3. If you use Python2 you may also install pip_. +.. _`install pip`: http://www.pip-installer.org/en/latest/index.html + +`Install pip`_ for a state of the art python package installer. + +Or consult `distribute docs`_ to install the ``easy_install`` +tool on your machine. + +You may also use the older `setuptools`_ project but it lacks bug fixes +and does not work on Python3. py.test not found on Windows despite installation? ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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. From commits-noreply at bitbucket.org Sat Sep 24 08:06:47 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Sat, 24 Sep 2011 06:06:47 -0000 Subject: [py-svn] commit/pytest: hpk42: add release announcement for 2.1.2 Message-ID: <20110924060647.18150.77501@bitbucket05.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/5864412c6f3c/ changeset: 5864412c6f3c user: hpk42 date: 2011-09-24 08:06:39 summary: add release announcement for 2.1.2 affected #: 2 files (-1 bytes) --- a/doc/announce/index.txt Fri Sep 23 07:35:47 2011 +0200 +++ b/doc/announce/index.txt Sat Sep 24 08:06:39 2011 +0200 @@ -5,6 +5,7 @@ .. toctree:: :maxdepth: 2 + release-2.1.2 release-2.1.1 release-2.1.0 release-2.0.3 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. From commits-noreply at bitbucket.org Sat Sep 24 14:12:09 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Sat, 24 Sep 2011 12:12:09 -0000 Subject: [py-svn] commit/pytest: hpk42: Added tag 2.1.2 for changeset 5864412c6f3c Message-ID: <20110924121209.18151.43182@bitbucket05.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/5fa7c4067b2c/ changeset: 5fa7c4067b2c user: hpk42 date: 2011-09-24 14:11:54 summary: Added tag 2.1.2 for changeset 5864412c6f3c affected #: 1 file (-1 bytes) --- a/.hgtags Sat Sep 24 08:06:39 2011 +0200 +++ b/.hgtags Sat Sep 24 14:11:54 2011 +0200 @@ -42,3 +42,4 @@ 49f11dbff725acdcc5fe3657cbcdf9ae04e25bbc 2.0.3 363e5a5a59c803e6bc176a6f9cc4bf1a1ca2dab0 2.0.3 e5e1746a197f0398356a43fbe2eebac9690f795d 2.1.0 +5864412c6f3c903384243bd315639d101d7ebc67 2.1.2 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. From commits-noreply at bitbucket.org Sat Sep 24 14:13:32 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Sat, 24 Sep 2011 12:13:32 -0000 Subject: [py-svn] commit/pytest: hpk42: bump version Message-ID: <20110924121332.18149.48475@bitbucket05.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/086777bfd05a/ changeset: 086777bfd05a user: hpk42 date: 2011-09-24 14:13:24 summary: bump version affected #: 3 files (-1 bytes) --- a/CHANGELOG Sat Sep 24 14:11:54 2011 +0200 +++ b/CHANGELOG Sat Sep 24 14:13:24 2011 +0200 @@ -1,3 +1,6 @@ +Changes between 2.1.1 and [next version] +---------------------------------------- + Changes between 2.1.1 and 2.1.2 ---------------------------------------- --- a/_pytest/__init__.py Sat Sep 24 14:11:54 2011 +0200 +++ b/_pytest/__init__.py Sat Sep 24 14:13:24 2011 +0200 @@ -1,2 +1,2 @@ # -__version__ = '2.1.2' +__version__ = '2.1.3dev1' --- a/setup.py Sat Sep 24 14:11:54 2011 +0200 +++ b/setup.py Sat Sep 24 14:13:24 2011 +0200 @@ -24,7 +24,7 @@ name='pytest', description='py.test: simple powerful testing with Python', long_description = long_description, - version='2.1.2', + version='2.1.3dev1', url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], 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. From commits-noreply at bitbucket.org Sat Sep 24 15:18:38 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Sat, 24 Sep 2011 13:18:38 -0000 Subject: [py-svn] commit/pytest: 2 new changesets Message-ID: <20110924131838.9266.57096@bitbucket13.managed.contegix.com> 2 new changesets in pytest: http://bitbucket.org/hpk42/pytest/changeset/99e50c37330e/ changeset: 99e50c37330e user: RonnyPfannschmidt date: 2011-09-23 10:53:03 summary: make call durations part of the test report affected #: 2 files (-1 bytes) --- a/_pytest/junitxml.py Fri Sep 23 07:35:47 2011 +0200 +++ b/_pytest/junitxml.py Fri Sep 23 10:53:03 2011 +0200 @@ -71,13 +71,12 @@ self.test_logs = [] self.passed = self.skipped = 0 self.failed = self.errors = 0 - self._durations = {} def _opentestcase(self, report): names = report.nodeid.split("::") names[0] = names[0].replace("/", '.') names = tuple(names) - d = {'time': self._durations.pop(report.nodeid, "0")} + d = {'time': getattr(report, 'duration', 0)} names = [x.replace(".py", "") for x in names if x != "()"] classnames = names[:-1] if self.prefix: @@ -176,13 +175,6 @@ elif report.skipped: self.append_skipped(report) - def pytest_runtest_call(self, item, __multicall__): - start = time.time() - try: - return __multicall__.execute() - finally: - self._durations[item.nodeid] = time.time() - start - def pytest_collectreport(self, report): if not report.passed: if report.failed: --- a/_pytest/runner.py Fri Sep 23 07:35:47 2011 +0200 +++ b/_pytest/runner.py Fri Sep 23 10:53:03 2011 +0200 @@ -1,6 +1,6 @@ """ basic collect and runtest protocol implementations """ -import py, sys +import py, sys, time from py._code.code import TerminalRepr def pytest_namespace(): @@ -95,12 +95,16 @@ #: context of invocation: one of "setup", "call", #: "teardown", "memocollect" self.when = when + self.start = time.time() try: - self.result = func() - except KeyboardInterrupt: - raise - except: - self.excinfo = py.code.ExceptionInfo() + try: + self.result = func() + except KeyboardInterrupt: + raise + except: + self.excinfo = py.code.ExceptionInfo() + finally: + self.stop = time.time() def __repr__(self): if self.excinfo: @@ -139,6 +143,7 @@ def pytest_runtest_makereport(item, call): when = call.when + duration = call.stop-call.start keywords = dict([(x,1) for x in item.keywords]) excinfo = call.excinfo if not call.excinfo: @@ -160,14 +165,15 @@ else: # exception in setup or teardown longrepr = item._repr_failure_py(excinfo) return TestReport(item.nodeid, item.location, - keywords, outcome, longrepr, when) + keywords, outcome, longrepr, when, + duration=duration) class TestReport(BaseReport): """ Basic test report object (also used for setup and teardown calls if they fail). """ def __init__(self, nodeid, location, - keywords, outcome, longrepr, when, sections=()): + keywords, outcome, longrepr, when, sections=(), duration=0): #: normalized collection node id self.nodeid = nodeid @@ -193,6 +199,9 @@ #: marshallable self.sections = list(sections) + #: time it took to run just the test + self.duration = duration + def __repr__(self): return "" % ( self.nodeid, self.when, self.outcome) http://bitbucket.org/hpk42/pytest/changeset/d1f0265f96f7/ changeset: d1f0265f96f7 user: hpk42 date: 2011-09-24 15:15:51 summary: fix issue67 - junitxml now contains correct durations. thanks ronny. affected #: 3 files (-1 bytes) --- a/CHANGELOG Sat Sep 24 14:13:24 2011 +0200 +++ b/CHANGELOG Sat Sep 24 15:15:51 2011 +0200 @@ -1,6 +1,8 @@ Changes between 2.1.1 and [next version] ---------------------------------------- +- fix issue67 / junitxml now contains correct test durations, thanks ronny + Changes between 2.1.1 and 2.1.2 ---------------------------------------- --- a/_pytest/junitxml.py Sat Sep 24 14:13:24 2011 +0200 +++ b/_pytest/junitxml.py Sat Sep 24 15:15:51 2011 +0200 @@ -71,13 +71,12 @@ self.test_logs = [] self.passed = self.skipped = 0 self.failed = self.errors = 0 - self._durations = {} def _opentestcase(self, report): names = report.nodeid.split("::") names[0] = names[0].replace("/", '.') names = tuple(names) - d = {'time': self._durations.pop(report.nodeid, "0")} + d = {'time': getattr(report, 'duration', 0)} names = [x.replace(".py", "") for x in names if x != "()"] classnames = names[:-1] if self.prefix: @@ -176,13 +175,6 @@ elif report.skipped: self.append_skipped(report) - def pytest_runtest_call(self, item, __multicall__): - start = time.time() - try: - return __multicall__.execute() - finally: - self._durations[item.nodeid] = time.time() - start - def pytest_collectreport(self, report): if not report.passed: if report.failed: --- a/_pytest/runner.py Sat Sep 24 14:13:24 2011 +0200 +++ b/_pytest/runner.py Sat Sep 24 15:15:51 2011 +0200 @@ -1,6 +1,6 @@ """ basic collect and runtest protocol implementations """ -import py, sys +import py, sys, time from py._code.code import TerminalRepr def pytest_namespace(): @@ -95,12 +95,16 @@ #: context of invocation: one of "setup", "call", #: "teardown", "memocollect" self.when = when + self.start = time.time() try: - self.result = func() - except KeyboardInterrupt: - raise - except: - self.excinfo = py.code.ExceptionInfo() + try: + self.result = func() + except KeyboardInterrupt: + raise + except: + self.excinfo = py.code.ExceptionInfo() + finally: + self.stop = time.time() def __repr__(self): if self.excinfo: @@ -139,6 +143,7 @@ def pytest_runtest_makereport(item, call): when = call.when + duration = call.stop-call.start keywords = dict([(x,1) for x in item.keywords]) excinfo = call.excinfo if not call.excinfo: @@ -160,14 +165,15 @@ else: # exception in setup or teardown longrepr = item._repr_failure_py(excinfo) return TestReport(item.nodeid, item.location, - keywords, outcome, longrepr, when) + keywords, outcome, longrepr, when, + duration=duration) class TestReport(BaseReport): """ Basic test report object (also used for setup and teardown calls if they fail). """ def __init__(self, nodeid, location, - keywords, outcome, longrepr, when, sections=()): + keywords, outcome, longrepr, when, sections=(), duration=0): #: normalized collection node id self.nodeid = nodeid @@ -193,6 +199,9 @@ #: marshallable self.sections = list(sections) + #: time it took to run just the test + self.duration = duration + def __repr__(self): return "" % ( self.nodeid, self.when, self.outcome) 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. From commits-noreply at bitbucket.org Sat Sep 24 15:19:12 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Sat, 24 Sep 2011 13:19:12 -0000 Subject: [py-svn] commit/pytest: hpk42: correct base version number Message-ID: <20110924131912.8808.34628@bitbucket03.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/ae8c01f1e252/ changeset: ae8c01f1e252 user: hpk42 date: 2011-09-24 15:19:03 summary: correct base version number affected #: 1 file (-1 bytes) --- a/CHANGELOG Sat Sep 24 15:15:51 2011 +0200 +++ b/CHANGELOG Sat Sep 24 15:19:03 2011 +0200 @@ -1,4 +1,4 @@ -Changes between 2.1.1 and [next version] +Changes between 2.1.2 and [next version] ---------------------------------------- - fix issue67 / junitxml now contains correct test durations, thanks ronny 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. From commits-noreply at bitbucket.org Sun Sep 25 07:41:53 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Sun, 25 Sep 2011 05:41:53 -0000 Subject: [py-svn] commit/pytest: hpk42: fix issue75 - test failure on jython. Message-ID: <20110925054153.17283.76209@bitbucket01.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/cdf4f616a0c3/ changeset: cdf4f616a0c3 user: hpk42 date: 2011-09-25 07:40:43 summary: fix issue75 - test failure on jython. also experimentally enable more tests in the jython test env. affected #: 4 files (-1 bytes) --- a/CHANGELOG Sat Sep 24 15:19:03 2011 +0200 +++ b/CHANGELOG Sun Sep 25 07:40:43 2011 +0200 @@ -2,6 +2,7 @@ ---------------------------------------- - fix issue67 / junitxml now contains correct test durations, thanks ronny +- fix issue75 / skipping test failure on jython Changes between 2.1.1 and 2.1.2 ---------------------------------------- --- a/_pytest/pytester.py Sat Sep 24 15:19:03 2011 +0200 +++ b/_pytest/pytester.py Sun Sep 25 07:40:43 2011 +0200 @@ -25,6 +25,7 @@ _pytest_fullpath except NameError: _pytest_fullpath = os.path.abspath(pytest.__file__.rstrip("oc")) + _pytest_fullpath = _pytest_fullpath.replace("$py.class", ".py") def pytest_funcarg___pytest(request): return PytestArg(request) --- a/testing/test_skipping.py Sat Sep 24 15:19:03 2011 +0200 +++ b/testing/test_skipping.py Sun Sep 25 07:40:43 2011 +0200 @@ -1,4 +1,5 @@ import pytest +import sys from _pytest.skipping import MarkEvaluator, folded_skips from _pytest.skipping import pytest_runtest_setup @@ -486,6 +487,10 @@ pass """) result = testdir.runpytest() + markline = " ^" + if sys.platform.startswith("java"): + # XXX report this to java + markline = "*" + markline[8:] result.stdout.fnmatch_lines([ "*ERROR*test_nameerror*", "*evaluating*skipif*expression*", @@ -493,7 +498,7 @@ "*ERROR*test_syntax*", "*evaluating*xfail*expression*", " syntax error", - " ^", + markline, "SyntaxError: invalid syntax", "*1 pass*2 error*", ]) --- a/tox.ini Sat Sep 24 15:19:03 2011 +0200 +++ b/tox.ini Sun Sep 25 07:40:43 2011 +0200 @@ -66,7 +66,7 @@ [testenv:jython] changedir=testing commands= - {envpython} {envbindir}/py.test-jython --no-tools-on-path \ + {envpython} {envbindir}/py.test-jython \ -rfsxX --junitxml={envlogdir}/junit-{envname}2.xml [] [pytest] 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. From commits-noreply at bitbucket.org Sun Sep 25 23:27:48 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Sun, 25 Sep 2011 21:27:48 -0000 Subject: [py-svn] commit/pytest: RonnyPfannschmidt: correctly handle zero length cmdline arguments Message-ID: <20110925212748.8809.56852@bitbucket03.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/29e491274688/ changeset: 29e491274688 user: RonnyPfannschmidt date: 2011-09-25 23:26:49 summary: correctly handle zero length cmdline arguments affected #: 3 files (-1 bytes) --- a/CHANGELOG Sun Sep 25 07:40:43 2011 +0200 +++ b/CHANGELOG Sun Sep 25 23:26:49 2011 +0200 @@ -1,6 +1,7 @@ Changes between 2.1.2 and [next version] ---------------------------------------- +- correctly handle zero length arguments (a la pytest '') - fix issue67 / junitxml now contains correct test durations, thanks ronny - fix issue75 / skipping test failure on jython --- a/_pytest/config.py Sun Sep 25 07:40:43 2011 +0200 +++ b/_pytest/config.py Sun Sep 25 23:26:49 2011 +0200 @@ -421,7 +421,7 @@ def getcfg(args, inibasenames): - args = [x for x in args if str(x)[0] != "-"] + args = [x for x in args if not str(x).startswith("-")] if not args: args = [py.path.local()] for arg in args: --- a/testing/test_config.py Sun Sep 25 07:40:43 2011 +0200 +++ b/testing/test_config.py Sun Sep 25 23:26:49 2011 +0200 @@ -16,6 +16,9 @@ config._preparse([sub]) assert config.inicfg['name'] == 'value' + def test_getcfg_empty_path(self, tmpdir): + cfg = getcfg([''], ['setup.cfg']) #happens on py.test "" + def test_append_parse_args(self, tmpdir): tmpdir.join("setup.cfg").write(py.code.Source(""" [pytest] 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. From commits-noreply at bitbucket.org Thu Sep 29 23:45:41 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Thu, 29 Sep 2011 21:45:41 -0000 Subject: [py-svn] commit/pytest: RonnyPfannschmidt: add a reportchar for reporting errors, fixes #76 Message-ID: <20110929214541.10725.45857@bitbucket01.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/d2f6742b377c/ changeset: d2f6742b377c user: RonnyPfannschmidt date: 2011-09-29 23:44:26 summary: add a reportchar for reporting errors, fixes #76 affected #: 3 files (-1 bytes) --- a/_pytest/skipping.py Sun Sep 25 23:26:49 2011 +0200 +++ b/_pytest/skipping.py Thu Sep 29 23:44:26 2011 +0200 @@ -169,21 +169,23 @@ elif char == "X": show_xpassed(terminalreporter, lines) elif char in "fF": - show_failed(terminalreporter, lines) + show_simple(terminalreporter, lines, 'failed', "FAIL %s") elif char in "sS": show_skipped(terminalreporter, lines) + elif char == "E": + show_simple(terminalreporter, lines, 'error', "ERROR %s") if lines: tr._tw.sep("=", "short test summary info") for line in lines: tr._tw.line(line) -def show_failed(terminalreporter, lines): +def show_simple(terminalreporter, lines, stat, format): tw = terminalreporter._tw - failed = terminalreporter.stats.get("failed") + failed = terminalreporter.stats.get(stat) if failed: for rep in failed: pos = rep.nodeid - lines.append("FAIL %s" %(pos, )) + lines.append(format %(pos, )) def show_xfailed(terminalreporter, lines): xfailed = terminalreporter.stats.get("xfailed") --- a/_pytest/terminal.py Sun Sep 25 23:26:49 2011 +0200 +++ b/_pytest/terminal.py Thu Sep 29 23:44:26 2011 +0200 @@ -15,7 +15,7 @@ group._addoption('-r', action="store", dest="reportchars", default=None, metavar="chars", help="show extra test summary info as specified by chars (f)ailed, " - "(s)skipped, (x)failed, (X)passed.") + "(E)error, (s)skipped, (x)failed, (X)passed.") group._addoption('-l', '--showlocals', action="store_true", dest="showlocals", default=False, help="show locals in tracebacks (disabled by default).") --- a/testing/test_skipping.py Sun Sep 25 23:26:49 2011 +0200 +++ b/testing/test_skipping.py Thu Sep 29 23:44:26 2011 +0200 @@ -472,6 +472,21 @@ "SKIP*four*", ]) +def test_reportchars_error(testdir): + testdir.makepyfile( + conftest=""" + def pytest_runtest_teardown(): + assert 0 + """, + test_simple=""" + def test_foo(): + pass + """) + result = testdir.runpytest('-rE') + result.stdout.fnmatch_lines([ + 'ERROR*test_foo*', + ]) + @pytest.mark.xfail("hasattr(sys, 'pypy_version_info')") def test_errors_in_xfail_skip_expressions(testdir): testdir.makepyfile(""" 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.