我正在使用nose测试框架。运行测试模块时,其中定义的拆卸功能失败。提出的错误表示灯具被另一个过程锁定。这里是我的测试模块,test_my_module.py:为什么python鼻子单元测试拆卸夹具失败
... ...
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)
... ...
有一个在test_output_dir它被用作固定物分贝(sqlite3的)文件。实际上这是因为被其他进程锁定而无法被拆卸的db文件。据我了解,在所有测试功能完成运行后,拆卸将始终运行。那么为什么会发生?为什么这些测试函数仍然可以锁定db文件?这是一个sqlite3问题,或者在我的测试代码中有一些错误?
你能否提供你的'init_test_db','destroy_test_db'和'fooN'函数发生了什么更多细节? – 2013-02-18 23:22:25