Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb8a47ba

Browse files
nejchJohnVillalovos
authored andcommitted
test(build): add smoke tests for sdist & wheel package
1 parent969dccc commitb8a47ba

File tree

5 files changed

+41
-1
lines changed

5 files changed

+41
-1
lines changed

‎.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ jobs:
2525
toxenv:py38
2626
-python-version:3.9
2727
toxenv:py39
28+
-python-version:3.9
29+
toxenv:smoke
2830
steps:
2931
-uses:actions/checkout@v2
3032
-name:Set up Python ${{ matrix.python-version }}

‎pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ module = [
1616
"setup",
1717
"tests.functional.*",
1818
"tests.functional.api.*",
19-
"tests.unit.*"
19+
"tests.unit.*",
20+
"tests.smoke.*"
2021
]
2122
ignore_errors =true
2223

‎tests/smoke/__init__.py

Whitespace-only changes.

‎tests/smoke/test_dists.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
importtarfile
2+
importzipfile
3+
frompathlibimportPath
4+
fromsysimportversion_info
5+
6+
importpytest
7+
fromsetuptoolsimportsandbox
8+
9+
fromgitlabimport__title__,__version__
10+
11+
DIST_DIR=Path("dist")
12+
TEST_DIR="tests"
13+
SDIST_FILE=f"{__title__}-{__version__}.tar.gz"
14+
WHEEL_FILE= (
15+
f"{__title__.replace('-','_')}-{__version__}-py{version_info.major}-none-any.whl"
16+
)
17+
18+
19+
@pytest.fixture(scope="function")
20+
defbuild():
21+
sandbox.run_setup("setup.py", ["clean","--all"])
22+
returnsandbox.run_setup("setup.py", ["sdist","bdist_wheel"])
23+
24+
25+
deftest_sdist_includes_tests(build):
26+
sdist=tarfile.open(DIST_DIR/SDIST_FILE,"r:gz")
27+
test_dir=sdist.getmember(f"{__title__}-{__version__}/{TEST_DIR}")
28+
asserttest_dir.isdir()
29+
30+
31+
deftest_wheel_excludes_tests(build):
32+
wheel=zipfile.ZipFile(DIST_DIR/WHEEL_FILE)
33+
assert [notfile.startswith(TEST_DIR)forfileinwheel.namelist()]

‎tox.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,7 @@ commands =
9696
deps = -r{toxinidir}/requirements-docker.txt
9797
commands =
9898
pytest --cov --cov-report xml tests/functional/api {posargs}
99+
100+
[testenv:smoke]
101+
deps = -r{toxinidir}/requirements-test.txt
102+
commands = pytest tests/smoke {posargs}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp