-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set location of coverage file in Travis #2937
Set location of coverage file in Travis #2937
Conversation
350a548
to
7088d04
Compare
7088d04
to
0534de0
Compare
It looks like the |
Dammit! |
be922aa
to
0534de0
Compare
😠 tried moving the |
@oliver-sanders and @matthewrmshin, I followed my steps from yesterday again this afternoon. And succeeded in running a local But then I realized there is something funny still happening when it runs with Travis. I've succeeded in getting the coverage for those files, when I ran from command line something similar to: $ export TRAVIS_BUILD_DIR=$(pwd -P)
$ sed -i -e "s|data_file=.coverage|data_file=${TRAVIS_BUILD_DIR}/.coverage|g" .coveragerc
$ export COVERAGE_PROCESS_START="${TRAVIS_BUILD_DIR}/.coveragerc"
$ export PYTHONPATH=$(pwd -P)/.travis
$ cylc register upstream tests/suite-state/upstream
$ cylc register polling tests/suite-state/polling
$ cylc run upstream
$ cylc run --no-detach polling --set UPSTREAM=upstream
$ coverage combine --append
$ coverage html Note that I don't even need to run However, when instead of registering the suites and running them, I call the test-battery command instead, it doesn't produce the right values: $ export TRAVIS_BUILD_DIR=$(pwd -P)
$ sed -i -e "s|data_file=.coverage|data_file=${TRAVIS_BUILD_DIR}/.coverage|g" .coveragerc
$ export COVERAGE_PROCESS_START="${TRAVIS_BUILD_DIR}/.coveragerc"
$ export PYTHONPATH=$(pwd -P)/.travis
$ cylc test-battery tests/suite-state/01-polling.t
$ coverage combine --append
$ coverage html If I call $ export TRAVIS_BUILD_DIR=$(pwd -P)
$ sed -i -e "s|data_file=.coverage|data_file=${TRAVIS_BUILD_DIR}/.coverage|g" .coveragerc
$ export COVERAGE_PROCESS_START="${TRAVIS_BUILD_DIR}/.coveragerc"
$ export PYTHONPATH=$(pwd -P)/.travis
$ export CYLC_TEST_RUN_GENERIC=${CYLC_TEST_RUN_GENERIC:-true}
$ export CYLC_TEST_RUN_PLATFORM=${CYLC_TEST_RUN_PLATFORM:-true}
$ export CYLC_TEST_SKIP=${CYLC_TEST_SKIP:-}
$ export CYLC_TEST_IS_GENERIC=true
$ export CYLC_TEST_TIME_INIT="$(date -u +'%Y%m%dT%H%M%SZ')"
$ prove -s -r "./tests/suite-state/01-polling.t"
$ coverage combine --append
$ coverage html
$ export TRAVIS_BUILD_DIR=$(pwd -P)
$ sed -i -e "s|data_file=.coverage|data_file=${TRAVIS_BUILD_DIR}/.coverage|g" .coveragerc
$ export COVERAGE_PROCESS_START="${TRAVIS_BUILD_DIR}/.coveragerc"
$ export PYTHONPATH=$(pwd -P)/.travis
$ export CYLC_TEST_RUN_GENERIC=${CYLC_TEST_RUN_GENERIC:-true}
$ export CYLC_TEST_RUN_PLATFORM=${CYLC_TEST_RUN_PLATFORM:-true}
$ export CYLC_TEST_SKIP=${CYLC_TEST_SKIP:-}
$ export CYLC_TEST_IS_GENERIC=true
$ export CYLC_TEST_TIME_INIT="$(date -u +'%Y%m%dT%H%M%SZ')"
# EDIT 01-polling, leaving just cylc run --reference-test --debug --no-detach --set UPSTREAM=$UPSTREAM $SUITE_NAME
$ prove -s -r "./tests/suite-state/01-polling.t"
$ coverage combine --append
$ coverage html
So really awkward that running through |
cd3687f
to
8f0e114
Compare
8f0e114
to
a314f13
Compare
Ra! Enabled the trace option for debugging. Turns out the source directories were not matching. So when the process is forked, it cannot find the coverage RC file, but also it tries to load the source folders ( Fixed by adding two more And, good news! Coverage went up to 83.99%! 🎉 Might have another look at what is not being tested and see if there's anything to keep an eye on during the Python3 migration. But the coverage of the existing functional tests is really impressive. Well done!! 👏 👏 This pull request is ready for review. |
We are not so bad after all! |
Brilliant news, made my day 😁 👏 |
(I was a little surprised that our tests didn't give better coverage than seemed to be the case at first... so nice to find our intuition wasn't too far off after all!) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
84% seems a bit more realistic to me!
Adding a
sed
command to our.travis.yml
to use an absolute directory for the coverage data file. This way when processes are forked, they will use the same location, instead of a location relative to their working directory.This should increase the coverage of the project, and cover files such as
daemonize.py
.Bruno