PREREQ_PM
specifies the runtime prerequisites, but how to specify which modules are required to run the test cases?
Should I use BUILD_REQUIRES
for this?
PREREQ_PM
specifies the runtime prerequisites, but how to specify which modules are required to run the test cases?
Should I use BUILD_REQUIRES
for this?
从ExtUtils::MakeMaker 6.64 开始,有一个TEST_REQUIRES
参数。
use ExtUtils::MakeMaker 6.64;
WriteMakefile(
...,
TEST_REQUIRES => {
Test::More => 0.95,
},
...,
);
CPAN::Meta::Spec定义了模块如何将其先决条件传达给工具链。第 2 版规范修改了列出先决条件的方式。该test
阶段现在有自己的先决条件列表。
但是 MakeMaker 尚未针对 v2 规范进行更新,而且可能永远不会更新。我所知道的唯一完全兼容的 v2 分发工具是Dist::Zilla(我推荐它的原因不止于此)。
当CPAN::Meta::Converter从 v2 规范转换为v1.4时,它会将test
需求合并到build_requires
.
所以是的,如果你坚持使用 MakeMaker,运行测试所需的任何模块都应该列在BUILD_REQUIRES
. 应该只包含安装模块后PREREQ_PM
仍然需要的模块。
如果测试在没有模块的情况下失败,那么PREREQ_PM
无论是测试还是运行模块都需要它,我都会将其列出。
如果我需要用于某些测试的模块,但不需要它们来运行模块,我会在测试运行时检测到这些模块,如果找不到它们,我会跳过测试(通过 PASS)。
我认为 ExtUtils::MakeMaker 中没有您想要的任何字段。