Do not re-run tests if they failed already
[pyi2ncommon] / run_unittests.sh
CommitLineData
989ee893
CH
1#!/bin/sh
2
2b141a0a 3# run unittest suite using python3
989ee893 4
f365f614
CH
5# The software in this package is distributed under the GNU General
6# Public License version 2 (with a special exception described below).
7#
8# A copy of GNU General Public License (GPL) is included in this distribution,
9# in the file COPYING.GPL.
10#
11# As a special exception, if other files instantiate templates or use macros
12# or inline functions from this file, or you compile this file and link it
13# with other works to produce a work based on this file, this file
14# does not by itself cause the resulting work to be covered
15# by the GNU General Public License.
16#
17# However the source code for this file must still be made available
18# in accordance with section (3) of the GNU General Public License.
19#
20# This exception does not invalidate any other reasons why a work based
21# on this file might be covered by the GNU General Public License.
22#
23# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
24
ee30d321 25case "${1:-}" in
c9d6f8e0
CH
26 "") cmd="python3 -m unittest discover test" ;;
27 test.*) cmd="python3 -m unittest \"$1\"" ;;
28 *) cmd="python3 -m unittest \"test.$1\"" ;;
ee30d321 29esac
c9d6f8e0
CH
30
31# run unittests in regular environment
32$cmd
0359bfe2
CH
33if [[ $? != 0 ]]; then
34 exit 1;
35fi
c9d6f8e0
CH
36
37# re-run with minimal local to capture errors caused by stdout being bytes
38LANG=C $cmd