From d0804f29ed617d358b2de0f92c1d7d60f8f9c534 Mon Sep 17 00:00:00 2001 From: HansBug Date: Sun, 14 Aug 2022 10:28:14 +0800 Subject: [PATCH] dev(hansbug): ignore one bug on torch --- test/numpy/test_array.py | 7 ++++++- test/torch/tensor/test_clazz.py | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/test/numpy/test_array.py b/test/numpy/test_array.py index 45a3ba8e4..f05acedb0 100644 --- a/test/numpy/test_array.py +++ b/test/numpy/test_array.py @@ -3,7 +3,7 @@ import unittest import numpy as np import pytest import torch -from hbutils.testing import OS +from hbutils.testing import OS, vpython import treetensor.numpy as tnp import treetensor.torch as ttorch @@ -246,6 +246,11 @@ class TestNumpyArray: } }) + # Here is a bug in torch on Windows and python3.10 environment + # RuntimeError: Numpy is not available + # The only solution I found is to downgrade python to 3.9 ==, + # so this is currently unsolvable. + @unittest.skipIf(OS.windows and vpython >= '3.10', 'Bug in torch') def test_tensor(self): assert ttorch.isclose(self._DEMO_1.tensor().double(), ttorch.Tensor({ 'a': ttorch.Tensor([[1, 2, 3], [4, 5, 6]]), diff --git a/test/torch/tensor/test_clazz.py b/test/torch/tensor/test_clazz.py index c2cd2fd46..fa663171a 100644 --- a/test/torch/tensor/test_clazz.py +++ b/test/torch/tensor/test_clazz.py @@ -1,5 +1,8 @@ +import unittest + import numpy as np import torch +from hbutils.testing import vpython, OS from treevalue import typetrans, TreeValue, func_treelize import treetensor.numpy as tnp @@ -47,6 +50,11 @@ class TestTorchTensorClass: def test_numel(self): assert self._DEMO_1.numel() == 18 + # Here is a bug in torch on Windows and python3.10 environment + # RuntimeError: Numpy is not available + # The only solution I found is to downgrade python to 3.9 ==, + # so this is currently unsolvable. + @unittest.skipIf(OS.windows and vpython >= '3.10', 'Bug in torch') @choose_mark() def test_numpy(self): assert tnp.all(self._DEMO_1.numpy() == tnp.ndarray({ -- GitLab