Files
pytorch/test/test_package.py
Michael Suo 741d0f41d6 [package] split tests (#53749)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53749

Split up tests into cases that cover specific functionality. Goals:
1. Avoid the omnibus test file mess (see: test_jit.py) by imposing early
   structure and deliberately avoiding a generic TestPackage test case.
2. Encourage testing of individual APIs and components by example.
3. Hide the fake modules we created for these tests in their own folder.

You can either run the test files individually, or still use
test/test_package.py like before.

Also this isort + black formats all the tests.

Test Plan: Imported from OSS

Reviewed By: SplitInfinity

Differential Revision: D26958535

Pulled By: suo

fbshipit-source-id: 8a63048b95ca71f4f1aa94e53c48442686076034
2021-03-10 16:07:36 -08:00

15 lines
469 B
Python

def load_tests(loader, standard_tests, pattern):
"""Load all tests from `test/pacakge/`
"""
if pattern is None:
# Use the default pattern if none is specified by the test loader.
pattern = "test*.py"
package_tests = loader.discover("package", pattern=pattern)
standard_tests.addTests(package_tests)
return standard_tests
if __name__ == "__main__":
from torch.testing._internal.common_utils import run_tests
run_tests()