Files
pytorch/test/test_package.py
Catherine Lee 4519228f60 Reduce pytest blocklist part 2 (#96397)
Enable pytest for a few unique files.  pytest runs tests in a different order than unittest (but still a consistent ordering with respect to itself) and some tests change global state, causing other tests to fail.

`test_transpose_non_contiguous` in `test_torchinductor.py` gets impacted from some other test but I'm not sure which one, so my solution is to reset the metrics before the rest of the test is run.

`test_register_patterns` in `test_quantize_fx.py` adds extra keys to global variables, so remove them when the test is done via unittest's `addCleanUp` which also works on pytest.

pytest doesn't really have an equivalent for `load_tests` so change it to be like `test_jit` that imports all the classes.  I also attempted to dynamically import them, but I failed.

`test_public_api_surface` in `test_fx.py` checks for a backwards compatibility classification.  There is a different test in test_fx that results in `fuser_utils` being imported.  pytest runs this test before `test_public_api_surface` while unittest runs it after, so pytest sees `fuser_utils` when crawling through the modules.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/96397
Approved by: https://github.com/huydhn
2023-03-10 19:10:43 +00:00

26 lines
1.3 KiB
Python

# Owner(s): ["oncall: package/deploy"]
from package.test_resources import TestResources # noqa: F401
from package.test_model import ModelTest # noqa: F401
from package.test_dependency_api import TestDependencyAPI # noqa: F401
from package.test_mangling import TestMangling # noqa: F401
from package.test_misc import TestMisc # noqa: F401
from package.test_directory_reader import DirectoryReaderTest # noqa: F401
from package.test_importer import TestImporter # noqa: F401
from package.test_glob_group import TestGlobGroup # noqa: F401
from package.test_package_script import TestPackageScript # noqa: F401
from package.test_save_load import TestSaveLoad # noqa: F401
from package.test_repackage import TestRepackage # noqa: F401
from package.test_package_fx import TestPackageFX # noqa: F401
from package.test_dependency_hooks import TestDependencyHooks # noqa: F401
from package.test_load_bc_packages import TestLoadBCPackages # noqa: F401
from package.test_analyze import TestAnalyze # noqa: F401
from package.test_digraph import TestDiGraph # noqa: F401
from package.package_a.test_all_leaf_modules_tracer import TestAllLeafModulesTracer # noqa: F401
from package.package_a.test_nn_module import TestNnModule # noqa: F401
if __name__ == "__main__":
from torch.testing._internal.common_utils import run_tests
run_tests()