[SciPy-dev] Two new test failures

josef.pktd@gmai... josef.pktd@gmai...
Thu Nov 13 13:28:33 CST 2008

> Could you set the random seed manually in the test fixture setup? [1]
> This way the tests would fail deterministically. I think scipy.stats uses
> numpy.random, so calling numpy.random.seed would suffice.
> .. [1] cf. http://somethingaboutorange.com/mrl/projects/nose/
> --
> Pauli Virtanen

I have problems making my nose tests more complex.
All my tests are based on test generators with yield.

I did not manage to get the test generators to work inside a TestCase class
and using fixtures but I managed to work around that. I added a seed for the
random number generator to my test function so now I get deterministic results.

The problem, I still didn't manage to figure out, is how and
whether the knownfailureif decorator works with test generators, e.g.

this is my test:

@dec.knownfailureif(True, "This test is known to fail")
def test_discrete_rvs_cdf_fail():
    distknownfail = [ ['logser',   (0.6,)]]
    for distname, arg in distknownfail:
        if debug:
            print distname
        yield check_discrete_chisquare, distname, arg

this is the result:

ERROR: test_discrete_chisquare.test_discrete_rvs_cdf_fail
Traceback (most recent call last):
  File "C:\Programs\Python25\lib\site-packages\nose-0.10.4-py2.5.egg\nose\case.p
y", line 182, in runTest
  File "C:\Programs\Python25\lib\site-packages\numpy\testing\decorators.py", lin
e 119, in skipper
    raise KnownFailureTest, msg
KnownFailureTest: This test is known to fail

Ran 12 tests in 0.781s

FAILED (errors=1)

I get an error instead of a known failure which is not counted towards
failures and errors.

Is there a trick to get the decorators to work with generators or is this not


More information about the Scipy-dev mailing list