Skip to content

Commit c51abb4

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

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

.travis.yml

+33-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +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:
12+
- python: 3.7
13+
dist: xenial
14+
sudo: true
15+
env: MUTATION=yes
1216
- python: 2.7
1317
env: INSTRUMENTAL=yes
1418
- python: 2.6
@@ -74,6 +78,13 @@ install:
7478
travis_retry pip install -r build-requirements.txt;
7579
fi
7680
- if [[ $INSTRUMENTAL ]]; then travis_retry pip install instrumental; fi
81+
#- if [[ $MUTATION ]]; then travis_retry pip install cosmic-ray; fi
82+
# temporary, until https://github.com/sixty-north/cosmic-ray/pull/491 is merged
83+
- if [[ $MUTATION ]]; then pushd $(mktemp -d); fi
84+
- if [[ $MUTATION ]]; then git clone --branch sampling --depth 1 https://github.com/tomato42/cosmic-ray.git; fi
85+
- if [[ $MUTATION ]]; then cd cosmic-ray; fi
86+
- if [[ $MUTATION ]]; then python setup.py install; fi
87+
- if [[ $MUTATION ]]; then popd; fi
7788
- pip list
7889
script:
7990
- if [[ $TOX_ENV ]]; then tox -e $TOX_ENV; fi
@@ -101,6 +112,26 @@ script:
101112
if [[ $INSTRUMENTAL && $TRAVIS_PULL_REQUEST != "false" ]]; then
102113
instrumental -f .instrumental.cov -s | python diff-instrumental.py --read .diff-instrumental --fail-under 70 --max-difference -0.1
103114
fi
115+
# cosmic-ray (mutation testing) runs
116+
- if [[ $MUTATION ]]; then cosmic-ray init cosmic-ray.toml session.sqlite; fi
117+
- if [[ $MUTATION ]]; then cosmic-ray baseline --report session.sqlite; fi
118+
- if [[ $MUTATION ]]; then cr-report --show-output session.baseline.sqlite; fi
119+
- |
120+
if [[ $MUTATION ]]; then
121+
cosmic-ray exec session.sqlite &
122+
COSMIC_PID=$!
123+
# make sure that we output something every 10 minutes (otherwise travis will kill us)
124+
while kill -s 0 $COSMIC_PID; do
125+
sleep 300
126+
cr-report session.sqlite | tail -n 3;
127+
done &
128+
REPORT_PID=$!
129+
# kill exec after 25 minutes
130+
(sleep $((60*25)); kill $COSMIC_PID) &
131+
fi
132+
- if [[ $MUTATION ]]; then wait $COSMIC_PID ; kill $REPORT_PID ; true; fi
133+
- if [[ $MUTATION ]]; then cr-report --show-output session.sqlite | tail -n 40; fi
134+
- if [[ $MUTATION ]]; then cr-rate --estimate --fail-over 25 --confidence 99.9 session.sqlite; fi
104135
after_success:
105-
- if [[ -z $INSTRUMENTAL ]]; then coveralls; fi
136+
- if [[ -z $INSTRUMENTAL && -z $MUTATION ]]; then coveralls; fi
106137

cosmic-ray.sh

+1
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

cosmic-ray.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[cosmic-ray]
22
module-path = "src"
33
python-version = ""
4-
timeout = 120.0
4+
timeout = 300.0
55
exclude-modules = ['src/ecdsa/_version.py', 'src/ecdsa/test*']
66
test-command = "pytest -x src/"
77

0 commit comments

Comments
 (0)