test_iopath.py 992 B

12345678910111213141516171819202122232425262728
  1. # Copyright (c) Facebook, Inc. and its affiliates.
  2. #
  3. # This source code is licensed under the MIT license found in the
  4. # LICENSE file in the root directory of this source tree.
  5. import unittest
  6. from unittest import mock
  7. class TestIOPath(unittest.TestCase):
  8. def test_no_iopath(self):
  9. from .test_reproducibility import TestReproducibility
  10. with mock.patch.dict("sys.modules", {"iopath": None}):
  11. # reuse reproducibility tests, which are e2e tests that should cover
  12. # most checkpoint related functionality
  13. TestReproducibility._test_reproducibility(self, "test_reproducibility")
  14. def test_no_supports_rename(self):
  15. from .test_reproducibility import TestReproducibility
  16. with mock.patch("fairseq.file_io.PathManager.supports_rename") as mock_fn:
  17. mock_fn.return_value = False
  18. TestReproducibility._test_reproducibility(self, "test_reproducibility")
  19. if __name__ == "__main__":
  20. unittest.main()