#!/usr/bin/env bash

set -ex

# Depth 1
for f in anaconda_navigator/*.py; do
    "$PYTHON_TEST" "$f"
    if [ $? -ne 0 ]; then
        exit 1
    fi
done

# Depth 2
for f in anaconda_navigator/*/*.py; do
    # The application is tested separately
    if [[ $f == anaconda_navigator/app/*.py ]]; then
        continue
    fi
    if [[ $f == anaconda_navigator/widgets/main_window.py ]]; then
        continue
    fi
    "$PYTHON_TEST" "$f"
    if [ $? -ne 0 ]; then
        exit 1
    fi
done

# Depth 3
for f in anaconda_navigator/*/*/*.py; do
    # Dont tests external library
    if [[ $f == anaconda_navigator/external/UniversalAnalytics/HTTPLog.py ]]; then
        continue
    fi
    if [[ $f == anaconda_navigator/external/UniversalAnalytics/Tracker.py ]]; then
        continue
    fi
    "$PYTHON_TEST" "$f"
    if [ $? -ne 0 ]; then
        exit 1
    fi
done
