#!/bin/bash

#
#  Copyright 2017 TWO SIGMA OPEN SOURCE, LLC
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#
set -e

if [ "${SPARK_HOME}" == "" ]; then
    echo "Must set SPARK_HOME environment variable before running this script"
    exit 1
fi
if ! [ -d python/travis ]; then
    echo "This script must be run from the root of the Flint distribution!"
    exit 1
fi
source activate flint
# Note that py4j version depends on spark version.
export PYTHONPATH=${SPARK_HOME}/python:${SPARK_HOME}/python/lib/py4j-0.10.7-src.zip:${PYTHONPATH}

# Set base class for test cases
export FLINT_BASE_TESTCASE=SparkTestCase
cd python
python -W ignore -m unittest discover tests/ts
