|
1 | 1 | """Run smoke tests"""
|
2 |
| - |
3 | 2 | import argparse
|
| 3 | +import logging |
| 4 | + |
4 | 5 |
|
5 |
| -import torchaudio # noqa: F401 |
6 |
| -import torchaudio.compliance.kaldi # noqa: F401 |
7 |
| -import torchaudio.datasets # noqa: F401 |
8 |
| -import torchaudio.functional # noqa: F401 |
9 |
| -import torchaudio.models # noqa: F401 |
10 |
| -import torchaudio.pipelines # noqa: F401 |
11 |
| -import torchaudio.sox_effects # noqa: F401 |
12 |
| -import torchaudio.transforms # noqa: F401 |
13 |
| -import torchaudio.utils # noqa: F401 |
| 6 | +def base_smoke_test(): |
| 7 | + import torchaudio # noqa: F401 |
| 8 | + import torchaudio.compliance.kaldi # noqa: F401 |
| 9 | + import torchaudio.datasets # noqa: F401 |
| 10 | + import torchaudio.functional # noqa: F401 |
| 11 | + import torchaudio.models # noqa: F401 |
| 12 | + import torchaudio.pipelines # noqa: F401 |
| 13 | + import torchaudio.sox_effects # noqa: F401 |
| 14 | + import torchaudio.transforms # noqa: F401 |
| 15 | + import torchaudio.utils # noqa: F401 |
14 | 16 |
|
15 | 17 |
|
16 | 18 | def ffmpeg_test():
|
17 | 19 | from torchaudio.io import StreamReader # noqa: F401
|
18 | 20 |
|
19 | 21 |
|
20 | 22 | def main() -> None:
|
| 23 | + options = _parse_args() |
| 24 | + |
| 25 | + if options.debug: |
| 26 | + logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG) |
| 27 | + |
| 28 | + base_smoke_test() |
| 29 | + if options.ffmpeg: |
| 30 | + ffmpeg_test() |
| 31 | + print("Smoke test passed.") |
| 32 | + |
| 33 | + |
| 34 | +def _parse_args(): |
21 | 35 | parser = argparse.ArgumentParser()
|
22 | 36 |
|
23 | 37 | # Warning: Please note this option should not be widely used, only use it when absolutely necessary
|
24 | 38 | parser.add_argument("--no-ffmpeg", dest="ffmpeg", action="store_false")
|
| 39 | + parser.add_argument("--debug", action="store_true", help="Enable debug logging.") |
25 | 40 |
|
26 |
| - options = parser.parse_args() |
27 |
| - if options.ffmpeg: |
28 |
| - ffmpeg_test() |
| 41 | + return parser.parse_args() |
29 | 42 |
|
30 | 43 |
|
31 | 44 | if __name__ == "__main__":
|
|
0 commit comments