-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
修复目前launch已知问题: - [x] confirm输入n还是会继续执行 - [x] 拼接实验url时错误 - [x] 格式化日期时部分版本python报错 - [x] list的dashboard排版调整 此外,新增了一些测试函数,当launch相关接口响应3xx时,告诉用户需更新到最新版本
- Loading branch information
1 parent
304bc54
commit 4c36010
Showing
13 changed files
with
261 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,5 @@ torch | |
torchvision | ||
python-dotenv | ||
freezegun | ||
build | ||
build | ||
requests-mock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "swanlab", | ||
"version": "0.3.15-alpha.2", | ||
"version": "0.3.15-alpha.3", | ||
"description": "", | ||
"python": "true" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
r""" | ||
@DATE: 2024/7/27 15:07 | ||
@File: setup.py | ||
@IDE: pycharm | ||
@Description: | ||
测试tutils/setup.py | ||
""" | ||
import pytest | ||
import tutils.setup as SU | ||
|
||
|
||
def test_mock_login_info(): | ||
login_info = SU.mock_login_info() | ||
assert login_info.is_fail is False | ||
login_info = SU.mock_login_info(error_reason="Unauthorized") | ||
assert login_info.is_fail is True | ||
login_info = SU.mock_login_info(error_reason="Authorization Required") | ||
assert login_info.is_fail is True | ||
login_info = SU.mock_login_info(error_reason="Forbidden") | ||
assert login_info.is_fail is True | ||
login_info = SU.mock_login_info(error_reason="OK") | ||
assert login_info.is_fail is False | ||
|
||
|
||
def test_use_setup_http(): | ||
from swanlab.api import get_http | ||
with SU.UseSetupHttp() as http: | ||
assert http is not None | ||
assert get_http() is not None | ||
with pytest.raises(ValueError): | ||
get_http() | ||
|
||
|
||
def test_use_mocker(): | ||
with SU.UseMocker() as m: | ||
m.post("/tmp", text="mock") | ||
import requests | ||
from swanlab.package import get_host_api | ||
resp = requests.post(get_host_api() + "/tmp") | ||
assert resp.text == "mock" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
r""" | ||
@DATE: 2024/7/27 14:51 | ||
@File: test_cli_task.py | ||
@IDE: pycharm | ||
@Description: | ||
测试cli/task | ||
""" | ||
import pytest | ||
from swanlab.cli.commands.task.utils import UseTaskHttp | ||
import tutils.setup as SU | ||
|
||
|
||
def test_use_task_http_ok(): | ||
with SU.UseMocker() as m: | ||
m.post("/test", text="mock") | ||
with SU.UseSetupHttp(): | ||
with UseTaskHttp() as http: | ||
text = http.post("/test") | ||
assert text == "mock" | ||
|
||
|
||
def test_use_task_http_abandon(): | ||
with pytest.raises(SystemExit) as p: | ||
with SU.UseMocker() as m: | ||
m.post("/test", status_code=301, reason="Abandon") | ||
with SU.UseSetupHttp(): | ||
with UseTaskHttp() as http: | ||
http.post("/test") | ||
assert p.value.code == 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.