#!/usr/bin/env python
# Don't run tests from the root repo dir.
# We want to ensure we're importing from the installed
# binary package not from the CWD.

import os
import sys
from subprocess import check_call

_dname = os.path.dirname

REPO_ROOT = _dname(_dname(_dname(os.path.abspath(__file__))))
os.chdir(os.path.join(REPO_ROOT, 'tests'))

args = sys.argv[1:]
if not args:
    args = ['unit/', 'functional/']

check_call(['nosetests', '--with-coverage', '--cover-erase',
            '--cover-package', 'boto3', '--with-xunit', '--cover-xml',
            '-v'] + args)
