Skip to content

Commit

Permalink
fix: 使用当前环境的 Python 版本进行测试 (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
he0119 authored Apr 16, 2024
1 parent d365fac commit 8a70d17
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/lang/zh-CN/

- 修复指定 key 时无法正确读取配置的问题
- 插件测试时设置为 10 分钟超时
- 使用当前环境的 Python 版本进行测试

## [3.2.4] - 2024-02-04

Expand Down
7 changes: 6 additions & 1 deletion src/utils/plugin_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,18 @@ def get_env(self) -> dict[str, str]:
env.pop("VIRTUAL_ENV", None)
# 启用 LOGURU 的颜色输出
env["LOGURU_COLORIZE"] = "true"
# Poetry 配置
# https://python-poetry.org/docs/configuration/#virtualenvsin-project
env["POETRY_VIRTUALENVS_IN_PROJECT"] = "true"
# https://python-poetry.org/docs/configuration/#virtualenvsprefer-active-python-experimental
env["POETRY_VIRTUALENVS_PREFER_ACTIVE_PYTHON"] = "true"
return env

async def create_poetry_project(self) -> None:
if not self.path.exists():
self.path.mkdir()
proc = await create_subprocess_shell(
f"""poetry init -n && sed -i "s/\\^/~/g" pyproject.toml && poetry config virtualenvs.in-project true --local && poetry env info --ansi && poetry add {self.project_link}""",
f"""poetry init -n && sed -i "s/\\^/~/g" pyproject.toml && poetry env info --ansi && poetry add {self.project_link}""",
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
cwd=self.path,
Expand Down

0 comments on commit 8a70d17

Please sign in to comment.