Skip to content

Commit 8012682

Browse files
authored
Add testing report use ucloud test framework (#38)
ENHANCEMENTS: - Add testing report use ucloud test framework (#38)
1 parent 6df3f26 commit 8012682

File tree

25 files changed

+419
-2
lines changed

25 files changed

+419
-2
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ test: clean
3535
pytest
3636

3737
test-cov: clean
38-
pytest --cov=ucloud/core tests/test_core
38+
pytest --cov=ucloud/core tests
3939

4040
test-acc: clean
4141
USDKACC=1 pytest --cov=ucloud

tests/test_acceptance/conftest.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import json
2+
import os
3+
import pytest
4+
5+
from ucloud.testing.driver import spec
6+
from ucloud.client import Client
7+
8+
9+
@pytest.fixture(scope="session", autouse=True, name="client")
10+
def client_factory() -> Client:
11+
return Client(
12+
{
13+
"region": "cn-bj2",
14+
"project_id": os.getenv("UCLOUD_PROJECT_ID"),
15+
"public_key": os.getenv("UCLOUD_PUBLIC_KEY"),
16+
"private_key": os.getenv("UCLOUD_PRIVATE_KEY"),
17+
"max_retries": 10,
18+
"timeout": 60,
19+
}
20+
)
21+
22+
23+
@pytest.fixture(scope="module", autouse=True, name="variables")
24+
def variables_factory() -> dict:
25+
return {
26+
"Region": "cn-bj2",
27+
"Zone": "cn-bj2-05",
28+
"ProjectId": os.getenv("UCLOUD_PROJECT_ID"),
29+
}
30+
31+
32+
@pytest.fixture(scope="session", autouse=True)
33+
def save_report(request):
34+
def save_report_handler():
35+
with open("./report.json", "w") as f:
36+
json.dump(spec.json(), f)
37+
38+
request.addfinalizer(save_report_handler)

0 commit comments

Comments
 (0)