Eunit 超时不起作用
我正在尝试使用文件夹内的 eunit 运行所有单元测试,但似乎超时总是重置为 5 秒。
eg
模块:
-module(example).
-include_lib("eunit/include/eunit.hrl").
main_test() ->
% sleep for 10 seconds
?assertEqual(true, begin timer:sleep(10000), true end).
命令行:
Eshell V5.7.3 (abort with ^G)
1> c(example).
{ok,example}
2> eunit:test({timeout, 15, example}).
Test passed.
ok
3> eunit:test({timeout, 15, {dir, "."}}).
example: main_test (module 'example')...*timed out*
undefined
=======================================================
Failed: 0. Skipped: 0. Passed: 0.
One or more tests were cancelled.
error
如您所见,运行 {timeout, 15, example}
有效,但 {timeout, 15, {dir, "." }}
。有人知道吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对我来说,这是有道理的:整个目录的超时可能与各个测试的超时无关。
我会这样编写测试:(
添加下划线以创建测试表达式而不是测试本身;它全部位于 eunit 手册。我认为不可能以任何其他方式在测试本身中指定超时。)
To me that makes sense: the timeout for an entire directory is probably not related to the timeouts for the individual tests.
I would write the test like this:
(Underscores added to create a test expression instead of the test itself; it's all in the eunit manual. I don't think it's possible to specify a timeout in the test itself in any other way.)