Skip to content

Commit

Permalink
Add wheel tests
Browse files Browse the repository at this point in the history
add tests to check wheel contents.
These need to be implemented on ci as well.
  • Loading branch information
lioman committed Oct 28, 2023
1 parent 512d78d commit a0dde32
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
7 changes: 7 additions & 0 deletions pelican/tests/build_test/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
def pytest_addoption(parser):
parser.addoption(
"--check-wheel",
action="store",
default=False,
help="Check wheel contents.",
)
28 changes: 28 additions & 0 deletions pelican/tests/build_test/test_wheel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from pathlib import Path
import pytest
from zipfile import ZipFile


@pytest.mark.skipif(
"not config.getoption('--check-wheel')",
reason="Only run when --check-wheel is given",
)
def test_wheel_contents(pytestconfig):
"""
This test, should test the contents of the wheel to make sure,
that everything that is needed is included in the final build
"""
wheel_file = pytestconfig.getoption("--check-wheel")
assert wheel_file.endswith(".whl")
files_list = ZipFile(wheel_file).namelist()
## Check is theme files are copiedto wheel
simple_theme = Path("./pelican/themes/simple/templates")
for x in simple_theme.iterdir():
assert str(x) in files_list

## Check is tool templatesare copiedto wheel
tools = Path("./pelican/tools/templates")
for x in tools.iterdir():
assert str(x) in files_list

assert "pelican/tools/templates/tasks.py.jinja2" in files_list
6 changes: 0 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,6 @@ dev = [
"black<20.0,>=19.10b0",
]

[tool.pdm.build]
includes = ["THANKS", ]

# [tool.pdm.build.wheel-data]
# include = [{path = "include/**/*.h", relative-to = "include/"}]

[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"

0 comments on commit a0dde32

Please sign in to comment.