python程序中两类不同的错误_python – py.test – 当在不同目录中的测试被称为相同时的测试发现失败...

使用py.test,在不同目录中调用相同的两个测试会导致py.test失败。这是为什么?如何在不重命名所有测试的情况下更改此项?

重复做:

; cd /var/tmp/my_test_module

; mkdir -p ook/test

; mkdir -p eek/test

; touch ook/test/test_proxy.py

; touch eek/test/test_proxy.py

; py.test

============================= test session starts ==============================

platform linux2 -- Python 2.7.3 -- pytest-2.2.4

collected 0 items / 1 errors

==================================== ERRORS ====================================

___________________ ERROR collecting ook/test/test_proxy.py ____________________

import file mismatch:

imported module 'test_proxy' has this __file__ attribute:

/home/ygolanski/code/junk/python/mymodule/eek/test/test_proxy.py

which is not the same as the test file we want to collect:

/home/ygolanski/code/junk/python/mymodule/ook/test/test_proxy.py

HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules

=========================== 1 error in 0.01 seconds ============================

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值