Skip to content

Commit 57eff78

Browse files
committed
Added release information tests, prepared pyproject.toml for release
1 parent e510e32 commit 57eff78

File tree

2 files changed

+70
-3
lines changed

2 files changed

+70
-3
lines changed

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
44

55
[project] # https://packaging.python.org/en/latest/specifications/declaring-project-metadata/#declaring-project-metadata
66
name = "autotuning_methodology"
7-
version = "0.1.0.b1"
7+
version = "0.1.0b1"
88
authors = [
99
{name = "Floris-Jan Willemsen", email = "fjwillemsen97@gmail.com"},
1010
]
@@ -28,13 +28,12 @@ dependencies = [
2828
"progressbar2 >= 4.2.0",
2929
"jsonschema >= 4.17.3",
3030
"nonconformist >= 2.1.0",
31-
"kernel_tuner @ git+https://github.com/KernelTuner/kernel_tuner.git",
31+
"kernel_tuner >= 0.4.5",
3232
]
3333

3434
[project.optional-dependencies]
3535
dev = [
3636
"pylint >=2.14.4",
37-
"toml >= 0.10.2",
3837
"black >= 23.3.0",
3938
]
4039
docs = [
@@ -49,6 +48,7 @@ test = [
4948
"pytest-cov >= 4.0.0",
5049
"nox >= 2023.4.22",
5150
"crepes >= 0.2.0",
51+
"tomli >= 2.0.1", # can be replaced by built-in [tomllib](https://docs.python.org/3.11/library/tomllib.html) from Python 3.11
5252
]
5353

5454
[project.scripts]
@@ -67,6 +67,7 @@ addopts = "--cov --cov-config=.coveragerc --cov-report html --cov-report term-mi
6767
testpaths = [
6868
"tests/unit",
6969
"tests/integration",
70+
"tests/release",
7071
]
7172

7273
[tool.black]
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
"""Tests for release information."""
2+
3+
from importlib.resources import files
4+
from pathlib import Path
5+
6+
import tomli
7+
8+
package_root = Path(files("autotuning_methodology")).parent.parent
9+
pyproject_toml_path = package_root / "pyproject.toml"
10+
assert pyproject_toml_path.exists()
11+
with open(pyproject_toml_path, mode="rb") as fp:
12+
pyproject = tomli.load(fp)
13+
14+
15+
def test_read():
16+
"""Test whether the contents have been read correctly and the required keys are in place."""
17+
assert isinstance(pyproject, dict)
18+
assert "build-system" in pyproject
19+
assert "project" in pyproject
20+
21+
22+
def test_name():
23+
"""Ensure the name is consistent."""
24+
assert "name" in pyproject["project"]
25+
assert pyproject["project"]["name"] == "autotuning_methodology"
26+
27+
28+
def test_versioning():
29+
"""Test whether the versioning is PEP440 compliant."""
30+
from pep440 import is_canonical
31+
32+
assert "version" in pyproject["project"]
33+
assert is_canonical(pyproject["project"]["version"])
34+
35+
36+
def test_authors():
37+
"""Ensure the authors are specified."""
38+
assert "authors" in pyproject["project"]
39+
assert len(pyproject["project"]["authors"]) > 0
40+
41+
42+
def test_license():
43+
"""Ensure the license is set and the file exists."""
44+
assert "license" in pyproject["project"]
45+
license = pyproject["project"]["license"]
46+
assert len(license) > 0
47+
assert license["file"] == "LICENSE"
48+
assert Path(package_root / "LICENSE").exists()
49+
50+
51+
def test_readme():
52+
"""Ensure the readme is set and the file exists."""
53+
assert "readme" in pyproject["project"]
54+
readme = pyproject["project"]["readme"]
55+
assert len(readme) > 0
56+
assert Path(package_root / readme).exists()
57+
58+
59+
def test_project_keys():
60+
"""Check whether the expected keys in [project] are present."""
61+
project = pyproject["project"]
62+
assert "description" in project
63+
assert "keywords" in project
64+
assert "classifiers" in project
65+
assert "dependencies" in project
66+
assert "requires-python" in project

0 commit comments

Comments
 (0)