简体   繁体   中英

Set test case files for travis

I have this project on GitHub which has test case files. I run tests locally via pytest and all passed. But travis does not pass these tests and outputs errors:

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

I set path to test files this way:

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

I have tried with DIR_TEST_FILES = './test_samples' and with os module through path method. Nothing works for travis.

Any help will be highly appreciated.

Somehow your tests are being run from the log directory inside your build directory. Make sure that travis-ci is in the same directory when it runs tests as you are when you run tests. It may be helpful to include a pwd or ls in the script: section of your .travis.yml file initially so that you can determine the relative paths to your tests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM