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@gfedev21 ~/software/testpytest]$ls
> conftest.py  test_pytest.py
> (testpytest)blaugher@gfedev21 ~/software/testpytest]$cat conftest.py
> 
> option_tbstyle = 'line'
> 
> 
> def pytest_runtest_setup(item):
>     print ("setting up", item)
> (testpytest)blaugher@gfedev21 ~/software/testpytest]$cat test_pytest.py
> 
> def func(x):
>     return x + 1
> 
> def test_answer():
>     result = func(3)
>     assert result == 5
> 
> (testpytest)blaugher@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', <Function 'test_answer'>)
> ============================== 1 failed in 0.04 seconds
> ==============================
> 
> 
> (testpytest)blaugher@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', <Function 'test_answer'>)
> ============================== 1 failed in 0.04 seconds
> ==============================
> (testpytest)blaugher@gfedev21 ~/software/testpytest]$
> 
> 
> 
> 
> 
> 
> -- 
> They've just been waiting in a mountain for the right moment:
> http://modernthings.org/
> _______________________________________________
> py-dev mailing list
> py-dev@codespeak.net
> http://codespeak.net/mailman/listinfo/py-dev
> 
_______________________________________________
py-dev mailing list
py-dev@codespeak.net
http://codespeak.net/mailman/listinfo/py-dev

Reply via email to