File size: 993 Bytes
ee21b96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

import unittest
from unittest import mock


class TestIOPath(unittest.TestCase):

    def test_no_iopath(self):
        from .test_reproducibility import TestReproducibility

        with mock.patch.dict("sys.modules", {"iopath": None}):
            # reuse reproducibility tests, which are e2e tests that should cover
            # most checkpoint related functionality
            TestReproducibility._test_reproducibility(self, "test_reproducibility")

    def test_no_supports_rename(self):
        from .test_reproducibility import TestReproducibility

        with mock.patch("fairseq.file_io.PathManager.supports_rename") as mock_fn:
            mock_fn.return_value = False
            TestReproducibility._test_reproducibility(self, "test_reproducibility")


if __name__ == "__main__":
    unittest.main()