forked from drandreaskrueger/chainhammer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pytest.sh
executable file
·55 lines (45 loc) · 1.39 KB
/
pytest.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
echo
echo =====================================
echo test suite, with testrpc-py backend
echo =====================================
echo
# BOTH testrpc-py AND pytest must be run in the virtualenv!
source env/bin/activate
# py.test needs the unbuffer command to preserve colors
# testrpc needs the unbuffer command to redirect, otherwise log file is empty
# sudo apt-get install expect-dev
# start testrpc, an ethereum simulator, redirect stout/err to file
unbuffer testrpc-py &> tests/logs/testrpc-py.log &
PID=$!
echo testrpc-py started in background, logging into tests/logs/
echo you can watch it with tail -f tests/logs/testrpc-py.log
echo kill it with: kill $PID
echo
echo =====================================
echo
echo now run hammer/deploy.py once, to
echo A make sure there is a connection to a node
echo B print all the versions
echo C create some files needed locally
echo
cd hammer
./deploy.py
cd ..
echo
echo now the tests can start:
echo
# start tests, colored output to screen AND to file
unbuffer py.test -v --cov | tee tests/logs/py.test.log
echo
echo done.
echo killing the background testrpc-py now:
kill $PID
echo should be gone now:
ps aux | grep testrpc-py | grep -v grep
echo
echo remove temp files which were created during the tests
rm -f contract-abi.json contract-address.json last-experiment.json
echo
echo see tests/logs/ for the log files of this test:
echo cat tests/logs/*
echo