How can I tell Perl's prove utility to ignore certain tests?

一个人想着一个人 提交于 2019-12-04 07:22:27
creaktive

I usually do something like this:

$ find t/ -name '*.t' ! -name '*timeout*' | xargs prove -l

(skips slow timeout tests)

I managed to do this by using a sub-directory :

$ tree t/
t/
├── 01_tests.t
├── 02_tests.t
├── 03_tests.t
└── ignored
    └── 01_ignored.t

Then I do this to execute the normal tests:

$ prove -v t/*.t
t/01_tests.t ........ ok
t/02_tests.t ........ ok
t/03_tests.t ........ ok
Result: PASS

And this to execute the ignored tests in another context:

$ prove -v t/ignored/
t/ignored/01_ignored.t ........ ok
Result: PASS

Simple and efficient solution if your tests are not already stored in different sub-directories.

For making it easier to use, and document how to run the tests, I usually put those in a Makefile.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!