Skip to content

Commit 63ca6c6

Browse files
committed
Add Python testing to travis
1 parent 7cc2135 commit 63ca6c6

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

.travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ before_install:
66
- echo $LANG
77
- echo $LC_ALL
88
before_script:
9-
script: make test
9+
script: |
10+
make test
11+
python setup.py build
12+
sudo python setup.py install
13+
( cd python ; ./run_tests.sh )
1014
branches:
1115
only:
1216
- master

python/run_tests.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
TEST_SNIPPET="$(cat test.jsonnet)"
4+
5+
echo "Python testing Jsonnet snippet..."
6+
OUTPUT="$(python jsonnet_test_snippet.py "${TEST_SNIPPET}")"
7+
if [ "$?" != "0" ] ; then
8+
echo "Jsonnet execution failed:"
9+
echo "$OUTPUT"
10+
exit 1
11+
fi
12+
if [ "$OUTPUT" != "true" ] ; then
13+
echo "Got bad output:"
14+
echo "$OUTPUT"
15+
exit 1
16+
fi
17+
18+
echo "Python testing Jsonnet file..."
19+
OUTPUT="$(python jsonnet_test_file.py "test.jsonnet")"
20+
if [ "$?" != "0" ] ; then
21+
echo "Jsonnet execution failed:"
22+
echo "$OUTPUT"
23+
exit 1
24+
fi
25+
if [ "$OUTPUT" != "true" ] ; then
26+
echo "Got bad output:"
27+
echo "$OUTPUT"
28+
exit 1
29+
fi
30+
31+
echo "Python test passed."

python/test.jsonnet

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
std.assertEqual(({ x: 1, y: self.x } { x: 2 }).y, 2)
2+

0 commit comments

Comments
 (0)