From brianna.laugher at gmail.com Wed Jul 6 09:16:08 2011 From: brianna.laugher at gmail.com (Brianna Laugher) Date: Wed, 6 Jul 2011 17:16:08 +1000 Subject: [py-dev] conftest setting option_tbstyle doesn't work? Message-ID: Hi, I'm not sure if I'm using it wrong, but it seems like setting option_tbstyle to a value in conftest.py is not having the desired effect. In the project I use at work we had option_tbstyle = 'short' and it was working fine, but lately I noticed it doesn't work and tracebacks are long. Manually doing 'py.test --tb=short' still works. At work we are using 1.3.4 (planning to upgrade soon!) but I just did a little test (see below) and it seems to be the case with 2.0.3, as well. I put pytest_runtest_setup in the conftest to validate that it was being used at all. (This example is pretty trivial but with our system tests, the long tracebacks take many pages to scroll through.) So am I specifying this option wrong, or what else might I be doing wrong? Also, was the --help-config option removed? v2.0.3 doesn't seem to know about it. thanks, Brianna (testpytest)blaugher at gfedev21 ~/software/testpytest]$ls conftest.py test_pytest.py (testpytest)blaugher at gfedev21 ~/software/testpytest]$cat conftest.py option_tbstyle = 'line' def pytest_runtest_setup(item): print ("setting up", item) (testpytest)blaugher at gfedev21 ~/software/testpytest]$cat test_pytest.py def func(x): return x + 1 def test_answer(): result = func(3) assert result == 5 (testpytest)blaugher at gfedev21 ~/software/testpytest]$py.test ================================ test session starts ================================= platform linux2 -- Python 2.7.0 -- pytest-2.0.3 collected 1 items test_pytest.py F ====================================== FAILURES ====================================== ____________________________________ test_answer _____________________________________ def test_answer(): result = func(3) > assert result == 5 E assert 4 == 5 test_pytest.py:7: AssertionError ---------------------------------- Captured stdout ----------------------------------- ('setting up', ) ============================== 1 failed in 0.04 seconds ============================== (testpytest)blaugher at gfedev21 ~/software/testpytest]$py.test --tb=short ================================ test session starts ================================= platform linux2 -- Python 2.7.0 -- pytest-2.0.3 collected 1 items test_pytest.py F ====================================== FAILURES ====================================== ____________________________________ test_answer _____________________________________ test_pytest.py:7: in test_answer > assert result == 5 E assert 4 == 5 ---------------------------------- Captured stdout ----------------------------------- ('setting up', ) ============================== 1 failed in 0.04 seconds ============================== (testpytest)blaugher at gfedev21 ~/software/testpytest]$ -- They've just been waiting in a mountain for the right moment: http://modernthings.org/ From holger at merlinux.eu Wed Jul 6 10:13:28 2011 From: holger at merlinux.eu (holger krekel) Date: Wed, 6 Jul 2011 08:13:28 +0000 Subject: [py-dev] conftest setting option_tbstyle doesn't work? In-Reply-To: References: Message-ID: <20110706081328.GY20287@merlinux.eu> Hi Brianna, On Wed, Jul 06, 2011 at 17:16 +1000, Brianna Laugher wrote: > Hi, > > I'm not sure if I'm using it wrong, but it seems like setting > option_tbstyle to a value in conftest.py is not having the desired > effect. > In the project I use at work we had > option_tbstyle = 'short' > and it was working fine, but lately I noticed it doesn't work and > tracebacks are long. Manually doing 'py.test --tb=short' still works. Hum, can you try adding/using an .ini file with an "addopts" value liek "--tb=short" like described here: http://doc.pytest.org/en/latest/customize.html?highlight=addopts#adding-default-options this should work with pytest-2.0 and above. In fact, the tbstyle is not configurable from conftest.py files anymore from the 2.0 version on. HTH, holger > At work we are using 1.3.4 (planning to upgrade soon!) but I just did > a little test (see below) and it seems to be the case with 2.0.3, as > well. I put pytest_runtest_setup in the conftest to validate that it > was being used at all. (This example is pretty trivial but with our > system tests, the long tracebacks take many pages to scroll through.) > > So am I specifying this option wrong, or what else might I be doing wrong? > > Also, was the --help-config option removed? v2.0.3 doesn't seem to > know about it. > > thanks, > Brianna > > > (testpytest)blaugher at gfedev21 ~/software/testpytest]$ls > conftest.py test_pytest.py > (testpytest)blaugher at gfedev21 ~/software/testpytest]$cat conftest.py > > option_tbstyle = 'line' > > > def pytest_runtest_setup(item): > print ("setting up", item) > (testpytest)blaugher at gfedev21 ~/software/testpytest]$cat test_pytest.py > > def func(x): > return x + 1 > > def test_answer(): > result = func(3) > assert result == 5 > > (testpytest)blaugher at gfedev21 ~/software/testpytest]$py.test > ================================ test session starts > ================================= > platform linux2 -- Python 2.7.0 -- pytest-2.0.3 > collected 1 items > > test_pytest.py F > > ====================================== FAILURES > ====================================== > ____________________________________ test_answer > _____________________________________ > > def test_answer(): > result = func(3) > > assert result == 5 > E assert 4 == 5 > > test_pytest.py:7: AssertionError > ---------------------------------- Captured stdout > ----------------------------------- > ('setting up', ) > ============================== 1 failed in 0.04 seconds > ============================== > > > (testpytest)blaugher at gfedev21 ~/software/testpytest]$py.test --tb=short > ================================ test session starts > ================================= > platform linux2 -- Python 2.7.0 -- pytest-2.0.3 > collected 1 items > > test_pytest.py F > > ====================================== FAILURES > ====================================== > ____________________________________ test_answer > _____________________________________ > test_pytest.py:7: in test_answer > > assert result == 5 > E assert 4 == 5 > ---------------------------------- Captured stdout > ----------------------------------- > ('setting up', ) > ============================== 1 failed in 0.04 seconds > ============================== > (testpytest)blaugher at gfedev21 ~/software/testpytest]$ > > > > > > > -- > They've just been waiting in a mountain for the right moment: > http://modernthings.org/ > _______________________________________________ > py-dev mailing list > py-dev at codespeak.net > http://codespeak.net/mailman/listinfo/py-dev > From brianna.laugher at gmail.com Thu Jul 7 02:35:38 2011 From: brianna.laugher at gmail.com (Brianna Laugher) Date: Thu, 7 Jul 2011 10:35:38 +1000 Subject: [py-dev] conftest setting option_tbstyle doesn't work? In-Reply-To: <20110706081328.GY20287@merlinux.eu> References: <20110706081328.GY20287@merlinux.eu> Message-ID: On 6 July 2011 18:13, holger krekel wrote: > Hum, can you try adding/using an .ini file with an "addopts" value > liek "--tb=short" like described here: > > http://doc.pytest.org/en/latest/customize.html?highlight=addopts#adding-default-options > > this should work with pytest-2.0 and above. ?In fact, the tbstyle is not > configurable from conftest.py files anymore from the 2.0 version on. Ah, thanks. I didn't catch on to the fact that that had changed. Adding the pytest.ini works. And it even works on the 1.3.4 version as well. :) cheers Brianna From holger at merlinux.eu Sat Jul 9 12:06:47 2011 From: holger at merlinux.eu (holger krekel) Date: Sat, 9 Jul 2011 10:06:47 +0000 Subject: [py-dev] pytest-2.1.0: perfected assertions and bug fixes Message-ID: <20110709100647.GD12151@merlinux.eu> Welcome to the relase of pytest-2.1, a mature testing tool for Python, supporting CPython 2.4-3.2, Jython and latest PyPy interpreters. See the improved extensive docs (now also as PDF!) with tested examples here: http://pytest.org/ The single biggest news about this release are **perfected assertions** courtesy of Benjamin Peterson. You can now safely use ``assert`` statements in test modules without having to worry about side effects or python optimization ("-OO") options. This is achieved by rewriting assert statements in test modules upon import, using a PEP302 hook. See http://pytest.org/assert.html#advanced-assertion-introspection for detailed information. The work has been partly sponsored by my company, merlinux GmbH. For further details on bug fixes and smaller enhancements see below. If you want to install or upgrade pytest, just type one of:: pip install -U pytest # or easy_install -U pytest best, holger krekel / http://merlinux.eu Changes between 2.0.3 and 2.1.0 ---------------------------------------------- - fix issue53 call nosestyle setup functions with correct ordering - fix issue58 and issue59: new assertion code fixes - merge Benjamin's assertionrewrite branch: now assertions for test modules on python 2.6 and above are done by rewriting the AST and saving the pyc file before the test module is imported. see doc/assert.txt for more info. - fix issue43: improve doctests with better traceback reporting on unexpected exceptions - fix issue47: timing output in junitxml for test cases is now correct - fix issue48: typo in MarkInfo repr leading to exception - fix issue49: avoid confusing error when initizaliation partially fails - fix issue44: env/username expansion for junitxml file path - show releaselevel information in test runs for pypy - reworked doc pages for better navigation and PDF generation - report KeyboardInterrupt even if interrupted during session startup - fix issue 35 - provide PDF doc version and download link from index page From holger at merlinux.eu Sat Jul 9 12:33:32 2011 From: holger at merlinux.eu (holger krekel) Date: Sat, 9 Jul 2011 10:33:32 +0000 Subject: [py-dev] tox-1.1: bug fixes and improved workflow Message-ID: <20110709103332.GE12151@merlinux.eu> Hey all, i just released tox-1.1, the virtualenv/test/CI automation tool. See here for general information and install info: http://codespeak.net/~hpk/tox or http://tox.readthedocs.org (which is missing some navigation links at time of sending email) The release incorporates a number of bug fixes and an enhanced work flow: repeatedly calling tox without increasing version numbers now works (by calling pip -U --nodeps). With this release i consider tox pretty stable and fit for general use. best & thanks to all contributors, holger krekel 1.1 ----------------- - fix issue5 - don't require argparse for python versions that have it - fix issue6 - recreate virtualenv if installing dependencies failed - fix issue3 - fix example on frontpage - fix issue2 - warn if a test command does not come from the test environment - fixed/enhanced: except for initial install always call "-U --no-deps" for installing the sdist package to ensure that a package gets upgraded even if its version number did not change. (reported on TIP mailing list and IRC) - inline virtualenv.py (1.6.1) script to avoid a number of issues, particularly failing to install python3 environents from a python2 virtualenv installation. - rework and enhance docs for display on readthedocs.org