[py-dev] py.test and --session, re-run failures only

Martin Blais martin.blais at gmail.com
Sat Apr 2 02:52:50 CEST 2005


On Apr 1, 2005 7:48 PM, Ian Bicking <ianb at colorstudy.com> wrote:
> Martin Blais wrote:
> > oh, while we're taking a shot at the future, another feature that i
> > used to have was the ability to compare the test output to a fixed
> > file, we called this "expect files", because the test was expected to
> > generate specific output.  might not be useful now but you could note
> > that in the futures document as well, for some kinds of tests this can
> > be a quick-n-dirty way to write a test.  dump something on the output,
> > inspect it to make sure it's allright, dump that into an expect file.
> > could be easy to implement since you already capture the output text.
> > note that these kinds of tests fail on outputs sensitive to numerical
> > (im)precision.
> 
> That's called doctest ;) -- of course better integration of that is also
> in the future at this point.

well... not quite.  it's you have 1000 lines of output i wouldn't want
to have to skip that in the source code.


> > and another one: for C++ code which can crash, a timeout option is
> > absolutely *essential*.
> 
> This could potentially be implemented as a decorator, like:
> 
> @py.test.timeout(10)
> def test_cpp_code():
>      ...
> 
> def timeout(seconds):
>      def replacement_func(*args, **kw):
>          some stuff with alarm signals and whatnot...
>      return replacement_func
> 
> Of course, you can't apply a decorator globally with an option, but it's
> probably only in specific areas where you'd need this anyway.

IMHO that's generic enough an option to add globally.
besides i can hear lots of people cringe at decorators in the background...



More information about the Pytest-dev mailing list