Skip to content

Commit ee8882e

Browse files
authored
pytest测试工具单独发布为一个pypi包方便其他工具使用 (#27)
* 去除global扩展脚本,并且包名称修改为testsolar_pytestx * 调整pytest的版本依赖 * 替换为setup-pdm环境准备 * ruff format * 增加发布到pypi流程
1 parent 2b7f309 commit ee8882e

24 files changed

Lines changed: 69 additions & 65 deletions
Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,8 @@ name: PyTest Tool Build And Check
66
on:
77
push:
88
branches: [ "main" ]
9-
paths:
10-
- 'pytest/**'
11-
- '.github/workflows/pytest-build-check.yml'
129
pull_request:
1310
branches: [ "main" ]
14-
paths:
15-
- 'pytest/**'
16-
- '.github/workflows/pytest-build-check.yml'
1711

1812
jobs:
1913
pytest-build:
@@ -24,16 +18,14 @@ jobs:
2418
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
2519

2620
steps:
27-
- uses: actions/checkout@v3
28-
- name: Set up Python ${{ matrix.python-version }}
29-
uses: actions/setup-python@v3
21+
- uses: actions/checkout@v4
22+
- name: Set up PDM
23+
uses: pdm-project/setup-pdm@v4
3024
with:
3125
python-version: ${{ matrix.python-version }}
3226
- name: Install dependencies
3327
run: |
3428
cd pytest
35-
python -m pip install --upgrade pip
36-
curl -sSL https://pdm-project.org/install-pdm.py | python3 -
3729
pdm install -d
3830
- name: Lint with ruff
3931
run: |
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package
10+
11+
on:
12+
release:
13+
types: [ published ]
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
deploy:
20+
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: Set up PDM
26+
uses: pdm-project/setup-pdm@v4
27+
with:
28+
python-version: '3.x'
29+
- name: Install dependencies
30+
run: |
31+
cd pytest
32+
pdm install -d
33+
- name: Build package
34+
run: |
35+
cd pytest
36+
pdm build
37+
- name: Publish package
38+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
39+
with:
40+
user: __token__
41+
password: ${{ secrets.PYPI_API_TOKEN }}
42+
packages-dir: pytest

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# testtool-python
2-
Python Test Tool for TestSolar
2+
Pytest Test Tool for TestSolar

‎pytest/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# TestSolar Pytest Testtool
1+
# Pytest test tool for TestSolar
22

33
Require Python>=3.8.

‎pytest/pdm.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.

‎pytest/pyproject.toml‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
[project]
2-
name = "pytest"
2+
name = "testsolar-pytestx"
33
version = "0.1.0"
44
description = "Pytest tool for TestSolar"
55
authors = [
66
{name = "asiazhang2002", email = "asiazhang2002@gmail.com"},
77
]
88
dependencies = [
9-
"pytest>=8.1.1",
10-
"pytest-timeout>=2.3.1",
9+
"pytest>=6",
10+
"pytest-timeout>=2",
1111
"testsolar-testtool-sdk>=0.1.9",
1212
]
1313
requires-python = ">=3.8"
1414
readme = "README.md"
15-
license = {text = "MIT"}
15+
license = {text = "Apache-2.0"}
1616

1717

1818
[tool.pdm]
19-
distribution = false
19+
distribution = true
2020

2121
[tool.pdm.dev-dependencies]
2222
dev = [

‎pytest/src/load.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
if parent not in sys.path:
1212
sys.path.append(parent)
1313

14-
from pytestx.collector import collect_testcases # type: ignore # noqa: E402
14+
from testsolar_pytestx.collector import collect_testcases # type: ignore # noqa: E402
1515

1616

1717
def collect_testcases_from_args(

‎pytest/src/pytestx/extend/global_cleanup_extend.py‎

Lines changed: 0 additions & 2 deletions
This file was deleted.

‎pytest/src/pytestx/extend/global_extend.py‎

Lines changed: 0 additions & 28 deletions
This file was deleted.

‎pytest/src/pytestx/extend/global_setup_extend.py‎

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)