【问题标题】:What can I do to Makefile.PL so that when I run make test it runs the test suite with dancer environment set to 'test'?我可以对 Makefile.PL 做些什么,以便在我运行 make test 时它运行测试套件,并将 dancer 环境设置为“test”?
【发布时间】:2011-09-22 03:34:50
【问题描述】:

我希望能够在 dancer 应用顶层源目录(由“dancer -a appname”生成的目录)中键入“make test”,并让它在环境设置为“test”的情况下运行测试'。

或者,如果有人可以将我称为“开发舞者应用程序的最佳实践”的存储库,那就太好了!

【问题讨论】:

    标签: perl dancer


    【解决方案1】:

    我做了一些检查,在 dancer-users 邮件列表中发现了以下线程:

    http://lists.perldancer.org/pipermail/dancer-users/2011-March/001277.html

    简而言之;在您的测试文件中包括:

    use Dancer::Test;
    Dancer::set environment => 'testing';
    Dancer::Config->load;
    

    不要这样做:

    use Dancer;
    

    不过,我还没有测试过;但是帖子中的用户表示它对他们有用....

    【讨论】:

      【解决方案2】:

      您可以修改 makefile 以适当地设置 DANCER_ENVIRONMENT 变量。

      如果我有我的 druthers,尽管使用 Dancer::Test 会自动设置环境。

      【讨论】:

      • 修改makefile还不够好,因为下次运行“perl Makefile.PL”时内容将被覆盖。我可以要求 Makefile.PL 生成一个不同名称的 makefile 并提供我自己的 makefile 来设置环境变量,但这会有点难看。浏览 Dancer::Test 源代码,它似乎没有这样做。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-03
      • 1970-01-01
      • 2013-06-13
      • 2020-03-21
      • 1970-01-01
      相关资源
      最近更新 更多