#!/bin/sh -ex

export LC_ALL=C.UTF-8

QUILT_PATCHES=debian/patches quilt push -a || true
mkdir ${HOME}/tmp

for py in $(py3versions -d) `py3versions -s | sed "s/$(py3versions -d)//"`
do
    TMPDIR=${HOME}/tmp TOIL_TEST_QUICK=True TOIL_SKIP_DOCKER=True ${py} -m pytest \
	-n auto --dist loadscope \
	--junit-xml=$AUTOPKGTEST_ARTIFACTS/toil-tests-junit.xml \
	-vv -rs -W ignore -k "not (test_bioconda or AWSJobStoreTest or \
	awsjobstoretest or testCwlexample or CWLv10Test or CWLv11Test or \
	CWLv12Test or AWSAutoscaleTest or AWSStaticAutoscaleTest or test_cactus_integration or \
	AWSManagedAutoscaleTest or AWSAutoscaleTestMultipleNodeTypes or \
	AWSRestartTest or PreemptableDeficitCompensationTest or ToilDocumentationTest \
	or test_cwl_toil_kill or testImportReadFileCompatibility or testBuiltIn \
	or testVirtualEnv or CleanWorkDirTest or CWLOnARMTest or WdlLanguageSpecWorkflowsTest \
	or ToilWdlIntegrationTest or ToilWdlIntegrationTest or ToilDebugFileTest or WdlToilTest \
	or testPromisesWithJobStoreFileObjects or testPromisesWithNonCachingFileStore)" \
	--ignore /usr/lib/python3/dist-packages/toil/test/cwl/cwlTest.py \
	--ignore /usr/lib/python3/dist-packages/toil/test/wdl/wdltoil_test.py \
	--ignore /usr/lib/python3/dist-packages/toil/test/lib/aws/test_s3.py \
	--ignore /usr/lib/python3/dist-packages/toil/test/lib/aws/test_iam.py \
	--ignore /usr/lib/python3/dist-packages/toil/test/provisioners/aws/awsProvisionerTest.py \
	--pyargs toil.test
done

QUILT_PATCHES=debian/patches quilt pop -a || true
