Unverified Commit 3bab2b29 authored by moto's avatar moto Committed by GitHub
Browse files

[CI] Make *nix unit test fail if C++ extension is not available (#847)

Currently our test suites automatically/silently skip tests on C++ extension
if it is not available. This is nice in local env, but in CI these tests should be
enforced and reported as failure if C++ extension is not available.

This PR adds switch for making tests fail if C++ extension is not available,
and make CI for *nix fail if that's the case.
parent 7f99271d
......@@ -12,6 +12,7 @@ eval "$(./conda/bin/conda shell.bash hook)"
conda activate ./env
python -m torch.utils.collect_env
export TORCHAUDIO_TEST_FAIL_IF_NO_EXTENSION=1
export PATH="${PWD}/third_party/install/bin/:${PATH}"
if [ "${os}" == MacOSX ] ; then
......
......@@ -67,4 +67,12 @@ def skipIfNoModule(module, display_name=None):
skipIfNoSoxBackend = unittest.skipIf(
'sox' not in torchaudio.list_audio_backends(), 'Sox backend not available')
skipIfNoCuda = unittest.skipIf(not torch.cuda.is_available(), reason='CUDA not available')
skipIfNoExtension = skipIfNoModule('torchaudio._torchaudio', 'torchaudio C++ extension')
def skipIfNoExtension(test_item):
if (
not is_module_available('torchaudio._torchaudio')
and 'TORCHAUDIO_TEST_FAIL_IF_NO_EXTENSION' in os.environ
):
raise RuntimeError('torchaudio C++ extension is not available.')
return unittest.skip('torchaudio C++ extension is not available')(test_item)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment