提交 879e3074 编写于 作者: S silingtong123 提交者: liuwei1031

fix the unittest of test_check_import_scipy on V100 (#21853)

上级 a25418b3
...@@ -11,22 +11,22 @@ ...@@ -11,22 +11,22 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
#import paddle
#from paddle.importScipy import funcImportScipy
import six.moves.builtins as builtins import six.moves.builtins as builtins
from paddle.check_import_scipy import check_import_scipy from paddle.check_import_scipy import check_import_scipy
import unittest import unittest
def my_import(name, globals=None, locals=None, fromlist=(), level=0): def my_import(name, globals=None, locals=None, fromlist=(), level=0):
raise ImportError('DLL load failed,unittest: import scipy failed') raise ImportError('DLL load failed, unittest: import scipy failed')
class importTest(unittest.TestCase): class importTest(unittest.TestCase):
def test_import(self): def test_import(self):
testOsName = 'nt' testOsName = 'nt'
old_import = builtins.__import__
builtins.__import__ = my_import builtins.__import__ = my_import
self.assertRaises(ImportError, check_import_scipy, testOsName) self.assertRaises(ImportError, check_import_scipy, testOsName)
builtins.__import__ = old_import
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册