Skip to content

Commit 0901214

Browse files
committed
fix
1 parent 6b4f701 commit 0901214

5 files changed

Lines changed: 19 additions & 14 deletions

File tree

‎pytest/pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "testsolar-pytestx"
3-
version = "0.1.48"
3+
version = "0.1.49"
44
description = "Pytest tool for TestSolar"
55
authors = [
66
{name = "asiazhang2002", email = "asiazhang2002@gmail.com"},

‎pytest/src/testsolar_pytestx/raw_cmd_executor.py‎

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
11
import os
22
import subprocess
3-
from loguru import logger
3+
from .util import get_cache_directory
4+
45

56
JUNIT_XML_PATH = "testsolar_junit.xml"
67
COVERAGE_REPORT_PATH = "testsolar_pytest.lcov"
78

89

910
def get_result_save_path() -> str:
10-
try:
11-
cache_dir = os.path.expanduser("~/.cache")
12-
except Exception as e:
13-
logger.error(f"[PLUGIN] Failed to get user cache dir: {e}")
14-
return ""
11+
cache_dir = get_cache_directory()
1512
coverage_dir = os.path.join(cache_dir, ".testsolar", "coverage")
1613
if not os.path.exists(coverage_dir):
17-
try:
18-
os.makedirs(coverage_dir, mode=0o755, exist_ok=True)
19-
except OSError as e:
20-
logger.error(f"[PLUGIN] Failed to create coverage dir: {e}")
21-
return ""
14+
os.makedirs(coverage_dir, mode=0o755, exist_ok=True)
2215
return coverage_dir
2316

2417

‎pytest/src/testsolar_pytestx/util.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import platform
23
import shlex
34
from typing import List
45
from loguru import logger
@@ -53,3 +54,14 @@ def append_extra_args(args: List[str]) -> None:
5354
extra_args = os.environ.get("TESTSOLAR_TTP_EXTRAARGS", "")
5455
if extra_args:
5556
args.extend(shlex.split(extra_args))
57+
58+
59+
def get_cache_directory() -> str:
60+
system = platform.system()
61+
if system == "Windows":
62+
cache_dir = Path(os.getenv("LOCALAPPDATA", ""))
63+
elif system == "Darwin":
64+
cache_dir = Path.home() / "Library" / "Caches"
65+
else:
66+
cache_dir = Path.home() / ".cache"
67+
return str(cache_dir)

‎pytest/testtool.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ schemaVersion: 1.0
22
name: pytest
33
nameZh: pytest自动化测试
44
lang: python
5-
version: '0.1.48'
5+
version: '0.1.49'
66
langType: INTERPRETED
77
description: |-
88
pytest是一个成熟的全功能Python测试工具,可以帮助您编写更好的程序。此测试工具允许您在TestSolar上运行pytest。

‎pytest/uv.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)