【问题标题】:Set test case files for travis为 travis 设置测试用例文件
【发布时间】:2017-01-16 18:05:24
【问题描述】:

我在 GitHub 上有这个 project,它有测试用例文件。我通过 pytest 在本地运行测试并全部通过。但是 travis 没有通过这些测试并输出错误:

OSError: [Errno 2] No such file or directory: '/home/travis/build/b5y/log2html/tests/test_samples'

我这样设置测试文件的路径:

DIR_TEST_FILES = os.getcwd() + os.sep + 'tests' + os.sep + 'test_samples'

我已经通过path 方法尝试使用DIR_TEST_FILES = './test_samples' 和os 模块。对 travis 没有任何作用。

我们将不胜感激。

【问题讨论】:

    标签: python travis-ci pytest


    【解决方案1】:

    不知何故,您的测试是从构建目录中的日志目录运行的。确保 travis-ci 在运行测试时与运行测试时位于同一目录中。最初在.travis.yml 文件的script: 部分中包含pwd 或ls 可能会有所帮助,这样您就可以确定测试的相对路径。

    【讨论】:

    • 如何将目录更改为项目?只是cd log2html 不起作用。
    • cd 使用cd ..退出目录
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-22
    相关资源
    最近更新 更多