smoke_test.py 1.19 KB
Newer Older
moto's avatar
moto committed
1
"""Run smoke tests"""
2
import argparse
moto's avatar
moto committed
3
4
import logging

5

moto's avatar
moto committed
6
7
8
9
10
11
12
13
14
15
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
16
17
18
19
20
21
22


def ffmpeg_test():
    from torchaudio.io import StreamReader  # noqa: F401


def main() -> None:
moto's avatar
moto committed
23
24
25
26
27
28
29
30
31
32
33
34
    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():
35
36
37
38
    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")
moto's avatar
moto committed
39
    parser.add_argument("--debug", action="store_true", help="Enable debug logging.")
40

moto's avatar
moto committed
41
    return parser.parse_args()
42
43
44
45


if __name__ == "__main__":
    main()