Skip to content

Commit bc6a385

Browse files
authored
github action支持自动化测试
1 parent 632f367 commit bc6a385

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

.github/workflows/pytest.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: pytest
2+
3+
on: push
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: ["3.6", "3.7", "3.8", "3.9"]
12+
13+
steps:
14+
- name: Checkout codes # 获取源码,并进入项目根目录
15+
uses: actions/checkout@main
16+
- name: Installation depends # 安装依赖
17+
run: |
18+
pip install -r requirements.txt
19+
- name: Start test # 自动化测试
20+
run: |
21+
pytest -s test.py

test.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import torchvision.models as models
2+
from bobotools.torch_tools import Torch_Tools
3+
4+
#=================Torch工具类==============================
5+
def test_get_model_info():
6+
model = models.resnet18(pretrained=False)
7+
model_info=Torch_Tools.get_model_info([1,3,224,224],model)
8+
print(model_info)

0 commit comments

Comments
 (0)