Hi,
I have found a very bizarre problem that is only affecting my unit test
and not the main program. However I believe this could be a more
general problem that may occur in other circumstances.
I have modeled the behavior in a single python unit test file which
is attached to this file. I have tested this on two separate systems:
Gentoo linux:
python2.2.2
mysql Ver 11.18 Distrib 3.23.54, for pc-linux-gnu (i686)
Mac osx 10.2:
python2.2.2
mysql Ver 11.18 Distrib 3.23.52, for apple-darwin6.0 (powerpc)
Each of these shows exactly the same problem when I run the test.
If you run the test you should get the error:
===============================================================
FAIL: Test all of the basic operations the MachineStore provides.
----------------------------------------------------------------------
Traceback (most recent call last):
File "problem1.py", line 83, in test2
self.assertEquals(machine['hostname'], "test1")
File
"/Library/Frameworks/Python.framework/Versions/2.2/lib/python2.2/
unittest.py", line 286, in failUnlessEqual
raise self.failureException, \
AssertionError: 'bob' != 'test1'
----------------------------------------------------------------------
Ran 2 tests in 0.148s
If you look at test2, in problem1.py, then you will see that somehow
the data I set in test1 is being returned in test2. This doesn't make
any sense as the tables and data have been destroyed and recreated,
before each test is run.
I thought this might be a problem with caching so I disabled caching
in the machine object, using the documented "_cacheValue = False"
However this has made no difference.
I'm at a loss as to how to proceed with this. My instincts tell me the
problem
isn't with MySQL, however I don't really know how to show that. Although
my main program isn't affected by this, I won't be able to trust sql
object
until I know why the above behavior is occurring. I'm hoping its some
error on my part that a fresh set of eyes will reveal.
Can anyone help me with this or point me in the right direction? Thanks
in advance, all the best,
om
|