pombreda / gaeunit

Automatically exported from code.google.com/p/gaeunit
0 stars 0 forks source link

Context dependent tests may fail when format=plain #30

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a test that modifies the datastore or any api that has a 
permanent store, and another that asserts the some aspect of the api
2. Run them with format=plain
3. If the latter test depends on the modified part and is executed later, it 
fails
4. Both succeeds when format=html

What is the expected output? What do you see instead?
Test results should not vary between formats

What version of the product are you using? On what operating system?
r71

Please provide any additional information below.
The cause is that the same apiproxy is used for all test methods in a test 
suite.
This isn't a problem for format=html, because test methods are run 
individually and only a single test method is contained in a test suite.

A possible patch is attached. It creates a subclass of unittest.TestSuite and 
uses it internally to create a new apiproxy each time a test method is run.

GAETestCase could also have done the job, but I chose to subclass 
TestSuite instead so that a plain unittest.TestCase can be used in the test 
code.

Original issue reported on code.google.com by ento.ent...@gmail.com on 23 Jan 2010 at 12:16

Attachments: