diff --git a/.travis.yml b/.travis.yml index ca33852f..f64b1a34 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,11 +20,3 @@ jobs: fi cardboardlinter --refspec $TRAVIS_BRANCH -n auto; fi - - name: python unit tests - install: - - pip install --upgrade -r requirements_tests.txt; - pip install --upgrade . - script: - - if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then - python -m unittest; - fi diff --git a/taskcluster/tc-train-unittests.sh b/taskcluster/tc-train-unittests.sh new file mode 100644 index 00000000..4be52e90 --- /dev/null +++ b/taskcluster/tc-train-unittests.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -xe + +source $(dirname "$0")/tc-tests-utils.sh + +extract_python_versions "$1" "pyver" "pyver_pkg" "py_unicode_type" "pyconf" "pyalias" + +mkdir -p ${TASKCLUSTER_ARTIFACTS} || true + +virtualenv_activate "${pyalias}" "deepspeech" + +set -o pipefail +pip install --upgrade pip==19.3.1 setuptools==45.0.0 wheel==0.33.6 | cat +pushd ${HOME}/DeepSpeech/ds + pip install --upgrade . | cat + python -m unittest +popd +set +o pipefail diff --git a/taskcluster/test-training-unittests_8k-linux-amd64-py35m-opt.yml b/taskcluster/test-training-unittests_8k-linux-amd64-py35m-opt.yml new file mode 100644 index 00000000..d33ad21d --- /dev/null +++ b/taskcluster/test-training-unittests_8k-linux-amd64-py35m-opt.yml @@ -0,0 +1,12 @@ +build: + template_file: test-linux-opt-base.tyml + dependencies: + - "linux-amd64-ctc-opt" + system_setup: + > + apt-get -qq update && apt-get -qq -y install ${training.packages_trusty.apt} + args: + tests_cmdline: "${system.homedir.linux}/DeepSpeech/ds/taskcluster/tc-train-unittests.sh 3.5.8:m" + metadata: + name: "DeepSpeech on Linux AMD64 CPU training unittests using Python 3.5" + description: "Training unittests DeepSpeech LDC93S1 model for Linux/AMD64 using Python 3.5, for CPU only, and optimized version" diff --git a/taskcluster/test-training-unittests_8k-linux-amd64-py36m-opt.yml b/taskcluster/test-training-unittests_8k-linux-amd64-py36m-opt.yml new file mode 100644 index 00000000..195ddfe9 --- /dev/null +++ b/taskcluster/test-training-unittests_8k-linux-amd64-py36m-opt.yml @@ -0,0 +1,13 @@ +build: + template_file: test-linux-opt-base.tyml + dependencies: + - "linux-amd64-ctc-opt" + system_setup: + > + apt-get -qq update && apt-get -qq -y install ${training.packages_trusty.apt} + args: + tests_cmdline: "${system.homedir.linux}/DeepSpeech/ds/taskcluster/tc-train-unittests.sh 3.6.10:m" + metadata: + name: "DeepSpeech on Linux AMD64 CPU training unittests using Python 3.6" + description: "Training unittests DeepSpeech LDC93S1 model for Linux/AMD64 using Python 3.6, for CPU only, and optimized version" + \ No newline at end of file diff --git a/taskcluster/test-training-unittests_8k-linux-amd64-py37m-opt.yml b/taskcluster/test-training-unittests_8k-linux-amd64-py37m-opt.yml new file mode 100644 index 00000000..1f9aabc3 --- /dev/null +++ b/taskcluster/test-training-unittests_8k-linux-amd64-py37m-opt.yml @@ -0,0 +1,12 @@ +build: + template_file: test-linux-opt-base.tyml + dependencies: + - "linux-amd64-ctc-opt" + system_setup: + > + apt-get -qq update && apt-get -qq -y install ${training.packages_trusty.apt} + args: + tests_cmdline: "${system.homedir.linux}/DeepSpeech/ds/taskcluster/tc-train-unittests.sh 3.7.6:m" + metadata: + name: "DeepSpeech on Linux AMD64 CPU training unittests using Python 3.7" + description: "Training unittests DeepSpeech LDC93S1 model for Linux/AMD64 using Python 3.7, for CPU only, and optimized version" diff --git a/training/deepspeech_training/util/importers.py b/training/deepspeech_training/util/importers.py index 4868e4a3..a4c3c326 100644 --- a/training/deepspeech_training/util/importers.py +++ b/training/deepspeech_training/util/importers.py @@ -42,15 +42,17 @@ def get_validate_label(args): :return: The user-supplied validate_label function :type: function """ + # Python 3.5 does not support passing a pathlib.Path to os.path.* methods if 'validate_label_locale' not in args or (args.validate_label_locale is None): print('WARNING: No --validate_label_locale specified, your might end with inconsistent dataset.') return validate_label_eng - if not os.path.exists(os.path.abspath(args.validate_label_locale)): + validate_label_locale = str(args.validate_label_locale) + if not os.path.exists(os.path.abspath(validate_label_locale)): print('ERROR: Inexistent --validate_label_locale specified. Please check.') return None - module_dir = os.path.abspath(os.path.dirname(args.validate_label_locale)) + module_dir = os.path.abspath(os.path.dirname(validate_label_locale)) sys.path.insert(1, module_dir) - fname = os.path.basename(args.validate_label_locale).replace('.py', '') + fname = os.path.basename(validate_label_locale).replace('.py', '') locale_module = importlib.import_module(fname, package=None) return locale_module.validate_label