On 22/05/13 21:39, Anze Staric wrote:
It doesn't make sense to me yet. What data is set up in __init__s at the
moment and why is this not done in the setUp method?
trac.wiki.tests.formatter.WikiTestCase uses self.env.config.set.
ProductWikiTestCase in (bloodhound_multiproduct) tests.wiki.formatter
replaces self.env with ProductEnvironment. ProductEnvironments use
Configurations defined in multiproduct.config that basically save
settings to database.
TestSuite defined in tests.wiki.formatter first instantiates TestCases
for each of the available wiki syntax/resulting html pairs. When these
tests were run sequentially, tearDown of the first test removed the
intertrac configuration of all the tests, thus causing them to fail.
OK, that looks like trac doing too much in object initialisation, though
I am not sure of their justification yet. Are there any special features
of the env object that are being tested? If not, it strikes me that it
might be better to mock the environment and just make sure that it is
being used in the right way.
Apart from this kind of case, I was also thinking that it might be
better to get the reset_db method overridden so that it resets the
database back to the clean form that we want.
Cheers,
Gary