Commit 71b2634b authored by moto's avatar moto Committed by Facebook GitHub Bot
Browse files

Update smoke test (#3346)

Summary:
* Delay the import of torchaudio until the CLI options are parsed.
* Add option to set log level to DEBUG so that it's easy to see the issue with external libraries.

Pull Request resolved: https://github.com/pytorch/audio/pull/3346

Reviewed By: nateanl

Differential Revision: D46022546

Pulled By: mthrok

fbshipit-source-id: 9f988bbd770c2fd2bb260c3cfe02b238a9da2808
parent a79cf3ba
"""Run smoke tests"""
import argparse
import logging
import torchaudio # noqa: F401
import torchaudio.compliance.kaldi # noqa: F401
import torchaudio.datasets # noqa: F401
import torchaudio.functional # noqa: F401
import torchaudio.models # noqa: F401
import torchaudio.pipelines # noqa: F401
import torchaudio.sox_effects # noqa: F401
import torchaudio.transforms # noqa: F401
import torchaudio.utils # noqa: F401
def base_smoke_test():
import torchaudio # noqa: F401
import torchaudio.compliance.kaldi # noqa: F401
import torchaudio.datasets # noqa: F401
import torchaudio.functional # noqa: F401
import torchaudio.models # noqa: F401
import torchaudio.pipelines # noqa: F401
import torchaudio.sox_effects # noqa: F401
import torchaudio.transforms # noqa: F401
import torchaudio.utils # noqa: F401
def ffmpeg_test():
......@@ -18,14 +20,25 @@ def ffmpeg_test():
def main() -> None:
options = _parse_args()
if options.debug:
logging.basicConfig(format="%(levelname)s: %(message)s", level=logging.DEBUG)
base_smoke_test()
if options.ffmpeg:
ffmpeg_test()
print("Smoke test passed.")
def _parse_args():
parser = argparse.ArgumentParser()
# Warning: Please note this option should not be widely used, only use it when absolutely necessary
parser.add_argument("--no-ffmpeg", dest="ffmpeg", action="store_false")
parser.add_argument("--debug", action="store_true", help="Enable debug logging.")
options = parser.parse_args()
if options.ffmpeg:
ffmpeg_test()
return parser.parse_args()
if __name__ == "__main__":
......
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