提交 c68859ae 编写于 作者: HansBug's avatar HansBug 😆

test(hansbug): try fix the problem when testing win32 wheel

上级 1d4cd4a0
......@@ -12,11 +12,11 @@ skip = ["pp*"] # Do not build for PyPy
[tool.cibuildwheel.windows]
archs = ["x86", 'AMD64']
before-test = [# Unittest for windows
"pip install -r \"{project}/requirements-test.txt\"",
"pip install -r \"{project}\\requirements-test-win.txt\"",
]
test-command = [
"xcopy /e /i \"{project}/test\" test",
"copy \"{project}/pytest.ini\" pytest.ini",
"xcopy /e /i \"{project}\\test\" test",
"copy \"{project}\\pytest.ini\" pytest.ini",
"pytest test -sv -m unittest --log-level=DEBUG",
"rmdir /s /q test",
]
......
coverage>=5
mock>=4.0.3
flake8~=3.5
pytest~=6.2.5
pytest-cov~=3.0.0
pytest-mock~=3.6.1
pytest-xdist>=1.34.0
pytest-rerunfailures~=10.2
pytest-timeout~=2.0.2
pytest-benchmark~=3.4.0
testtools>=2
hbutils>=0.6.13
setuptools<=59.5.0
numpy>=1.10
easydict>=1.7,<2
\ No newline at end of file
import unittest
from functools import lru_cache
from typing import Optional
from hbutils.testing import vpip
try:
import torch
except ImportError:
torch = None
import pytest
import torch
from treevalue import TreeValue, func_treelize, FastTreeValue
_TREE_DATA_1 = {'a': torch.randn(2, 3), 'x': {'c': torch.randn(3, 4)}}
_TREE_1 = FastTreeValue(_TREE_DATA_1)
@lru_cache()
def _get_tree() -> Optional[FastTreeValue]:
if torch is not None:
_TREE_DATA_1 = {'a': torch.randn(2, 3), 'x': {'c': torch.randn(3, 4)}}
return FastTreeValue(_TREE_DATA_1)
else:
return None
@pytest.mark.benchmark(group='treevalue_dynamic')
@unittest.skipUnless(vpip('torch') >= '1.1.0', 'Torch>=1.1.0 only')
class TestTreeGeneralBenchmark:
def test_dynamic_execute(self, benchmark):
def sin(t):
return t.sin()
return benchmark(sin, _TREE_1)
return benchmark(sin, _get_tree())
def test_static_execute(self, benchmark):
sinf = func_treelize(return_type=TreeValue)(torch.sin)
......@@ -21,4 +38,4 @@ class TestTreeGeneralBenchmark:
def sin(t):
return sinf(t)
return benchmark(sin, _TREE_1)
return benchmark(sin, _get_tree())
import unittest
import pytest
import torch
from hbutils.testing import vpip
try:
import torch
except ImportError:
torch = None
from treevalue.tree import func_treelize, FastTreeValue
@pytest.mark.unittest
@unittest.skipUnless(vpip('torch') >= '1.1.0', 'Torch>=1.1.0 only')
def test_for_torch_support():
sin = func_treelize()(torch.sin)
cos = func_treelize()(torch.cos) # the same sin function
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册