Skip to content

Commit aa51b0f

Browse files
committed
test: fail CI if a test fails
* Fixed exit code of `python setup.py test` (was always zero). * Fixed exit code of test.sh (was always zero). * Fixed tarantool repo URI. * Added pyyaml as testing dependency. * Dropped shebangs and executable bits for test files (for unification purposes). Fixes #121.
1 parent 5068da6 commit aa51b0f

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

test.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1-
#!/bin/bash
1+
#!/bin/sh
22

3-
curl http://tarantool.org/dist/public.key | sudo apt-key add -
4-
echo "deb http://tarantool.org/dist/master/ubuntu/ `lsb_release -c -s` main" | sudo tee -a /etc/apt/sources.list.d/tarantool.list
3+
set -exu # Strict shell (w/o -o pipefail)
4+
5+
# Install tarantool.
6+
curl http://download.tarantool.org/tarantool/2x/gpgkey | sudo apt-key add -
7+
release=`lsb_release -c -s`
8+
echo "deb http://download.tarantool.org/tarantool/2x/ubuntu/ ${release} main" | sudo tee /etc/apt/sources.list.d/tarantool_2x.list
59
sudo apt-get update > /dev/null
610
sudo apt-get -q -y install tarantool
11+
12+
# Install testing dependencies.
713
pip install -r requirements.txt
14+
pip install pyyaml
15+
16+
# Run tests.
817
python setup.py test

unit/setup_command.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import sys
55
import unittest
66
import setuptools
7+
from distutils.errors import DistutilsError
78

89
from glob import glob
910

@@ -23,5 +24,7 @@ def run(self):
2324
'''
2425

2526
tests = unittest.defaultTestLoader.discover('unit')
26-
test_runner = unittest.TextTestRunner(verbosity = 2)
27-
test_runner.run(tests)
27+
test_runner = unittest.TextTestRunner(verbosity=2)
28+
result = test_runner.run(tests)
29+
if not result.wasSuccessful():
30+
raise DistutilsError('There are failed tests')

unit/suites/test_protocol.py

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env ipython
1+
# -*- coding: utf-8 -*-
22

33
from __future__ import print_function
44

unit/suites/test_schema.py

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env ipython
1+
# -*- coding: utf-8 -*-
22

33
from __future__ import print_function
44

0 commit comments

Comments
 (0)