Python unit-testing with nose: Making sequential tests

Posted by cool-RR on Stack Overflow See other posts from Stack Overflow or by cool-RR
Published on 2010-03-27T20:06:40Z Indexed on 2010/03/27 20:13 UTC
Read the original article Hit count: 421

Filed under:
|
|
|

I am just learning how to do unit-testing. I'm on Python / nose / Wing IDE.

(The project that I'm writing tests for is a simulations framework, and among other things it lets you run simulations both synchronously and asynchronously, and the results of the simulation should be the same in both.)

The thing is, I want some of my tests to use simulation results that were created in other tests. For example, synchronous_test calculates a certain simulation in synchronous mode, but then I want to calculate it in asynchronous mode, and check that the results came out the same.

How do I structure this? Do I put them all in one test function, or make a separate asynchronous_test? Do I pass these objects from one test function to another?

Also, keep in mind that all these tests will run through a test generator, so I can do the tests for each of the simulation packages included with my program.

© Stack Overflow or respective owner

Related posts about beginner

Related posts about python