Skip to content

Commit 3762ce6

Browse files
committed
add quick mutation testing to travis
1 parent 64e6d73 commit 3762ce6

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

.travis.yml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ language: python
66
cache: pip
77
before_cache:
88
- rm -f $HOME/.cache/pip/log/debug.log
9-
# place the slowest (instrumental and py2.6) first
9+
# place the slowest (instrumental, mutation and py2.6) first
1010
matrix:
1111
include:
1212
- python: 2.7
1313
env: INSTRUMENTAL=yes
14+
- python: 3.7
15+
env: MUTATION=yes
1416
- python: 2.6
1517
env: TOX_ENV=py26
1618
- python: 2.7
@@ -74,6 +76,13 @@ install:
7476
travis_retry pip install -r build-requirements.txt;
7577
fi
7678
- if [[ $INSTRUMENTAL ]]; then travis_retry pip install instrumental; fi
79+
- if [[ $MUTATION ]]; then travis_retry pip install cosmic-ray; fi
80+
# temporary, until https://github.com/sixty-north/cosmic-ray/pull/491 is merged
81+
- pushd $(mktemp -d)
82+
- git clone --branch sampling --depth 1 https://github.com/tomato42/cosmic-ray.git
83+
- cd cosmic-ray
84+
- python setup.py install
85+
- popd
7786
- pip list
7887
script:
7988
- if [[ $TOX_ENV ]]; then tox -e $TOX_ENV; fi
@@ -101,6 +110,25 @@ script:
101110
if [[ $INSTRUMENTAL && $TRAVIS_PULL_REQUEST != "false" ]]; then
102111
instrumental -f .instrumental.cov -s | python diff-instrumental.py --read .diff-instrumental --fail-under 70 --max-difference -0.1
103112
fi
113+
# cosmic-ray (mutation testing) runs
114+
- if [[ $MUTATION ]]; then cosmic-ray init cosmic-ray.toml session.sqlite; fi
115+
- if [[ $MUTATION ]]; then cosmic-ray baseline --report session.sqlite; fi
116+
- if [[ $MUTATION ]]; then cr-report --show-output session.baseline.sqlite; fi
117+
- |
118+
if [[ $MUTATION ]]; then
119+
cosmic-ray exec session.sqlite &
120+
COSMIC_PID=$!
121+
# make sure that we output something every 10 minutes (otherwise travis will kill us)
122+
while kill -s 0 $COSMIC_PID; do
123+
sleep 300
124+
cr-report session.sqlite | tail -n 3;
125+
done &
126+
REPORT_PID=$!
127+
# kill exec after 20 minutes
128+
(sleep $((60*20)); kill $COSMIC_PID) &
129+
fi
130+
- if [[ $MUTATION ]]; then wait $COSMIC_PID ; kill $REPORT_PID ; true; fi
131+
- if [[ $MUTATION ]]; then cr-rate --estimate --fail-over 25 --confidence 99.9 session.sqlite; fi
104132
after_success:
105-
- if [[ -z $INSTRUMENTAL ]]; then coveralls; fi
133+
- if [[ -z $INSTRUMENTAL && -z $MUTATION ]]; then coveralls; fi
106134

cosmic-ray.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ cr-report --show-output session.baseline.sqlite
77
cosmic-ray exec session.sqlite
88
cr-report session.sqlite
99
cr-html session.sqlite > session.html
10+
cr-rate --estimate --fail-over 25 --confidence 99.9 session.sqlite

0 commit comments

Comments
 (0)