Hi,
I'm using nose test framework. When running a test module, the teardown function defined in it failed. the error raised says the fixture is locked by another process. here is my test module, test_my_module.py:
... ...
def teardown():
if os.path.exists(test_output_dir):
shutil.rmtree(test_output_dir)
... ...
@with_setup(init_test_db, destroy_test_db)
def test_foo1():
eq_(foo1(),1)
@with_setup(init_test_db, destroy_test_db)
def test_foo2():
eq_(foo2(),2)
... ...
There is a db(sqlite3) file in the test_output_dir which been used as fixture. Actually it is that db file that cannot be remove by the teardown, due to it be locked by other process. To my understand, a teardown will always run after all test functions finished running. So why does that happen ? why can those test functions still lock the db file? Is it a sqlite3 issue or it's some wrong in my test code?