#!/bin/sh

# script/test: Run test suite for application. Optionallly pass in a path to an
#              individual test file to run a single test.

cd "$(dirname "$0")/.."

script/lint

LINT_STATUS=$?

echo "Running tests..."

if [ "$1" = "coverage" ]; then
  py.test --cov --cov-report=
  TEST_STATUS=$?
else
  py.test
  TEST_STATUS=$?
fi

if [ $LINT_STATUS -eq 0 ]
then
  exit $TEST_STATUS
else
  exit $LINT_STATUS
fi