diff --git a/pyproject.toml b/pyproject.toml index 0fa0281..7d61af7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"] [project] # https://packaging.python.org/en/latest/specifications/declaring-project-metadata/#declaring-project-metadata name = "autotuning_methodology" -version = "0.1.0.b1" +version = "0.1.0b1" authors = [ {name = "Floris-Jan Willemsen", email = "fjwillemsen97@gmail.com"}, ] @@ -28,13 +28,12 @@ dependencies = [ "progressbar2 >= 4.2.0", "jsonschema >= 4.17.3", "nonconformist >= 2.1.0", - "kernel_tuner @ git+https://github.com/KernelTuner/kernel_tuner.git", + "kernel_tuner >= 0.4.5", ] [project.optional-dependencies] dev = [ "pylint >=2.14.4", - "toml >= 0.10.2", "black >= 23.3.0", ] docs = [ @@ -49,6 +48,7 @@ test = [ "pytest-cov >= 4.0.0", "nox >= 2023.4.22", "crepes >= 0.2.0", + "tomli >= 2.0.1", # can be replaced by built-in [tomllib](https://docs.python.org/3.11/library/tomllib.html) from Python 3.11 ] [project.scripts] @@ -67,6 +67,7 @@ addopts = "--cov --cov-config=.coveragerc --cov-report html --cov-report term-mi testpaths = [ "tests/unit", "tests/integration", + "tests/release", ] [tool.black] diff --git a/tests/autotuning_methodology/release/test_toml_file.py b/tests/autotuning_methodology/release/test_toml_file.py new file mode 100644 index 0000000..0cf0097 --- /dev/null +++ b/tests/autotuning_methodology/release/test_toml_file.py @@ -0,0 +1,66 @@ +"""Tests for release information.""" + +from importlib.resources import files +from pathlib import Path + +import tomli + +package_root = Path(files("autotuning_methodology")).parent.parent +pyproject_toml_path = package_root / "pyproject.toml" +assert pyproject_toml_path.exists() +with open(pyproject_toml_path, mode="rb") as fp: + pyproject = tomli.load(fp) + + +def test_read(): + """Test whether the contents have been read correctly and the required keys are in place.""" + assert isinstance(pyproject, dict) + assert "build-system" in pyproject + assert "project" in pyproject + + +def test_name(): + """Ensure the name is consistent.""" + assert "name" in pyproject["project"] + assert pyproject["project"]["name"] == "autotuning_methodology" + + +def test_versioning(): + """Test whether the versioning is PEP440 compliant.""" + from pep440 import is_canonical + + assert "version" in pyproject["project"] + assert is_canonical(pyproject["project"]["version"]) + + +def test_authors(): + """Ensure the authors are specified.""" + assert "authors" in pyproject["project"] + assert len(pyproject["project"]["authors"]) > 0 + + +def test_license(): + """Ensure the license is set and the file exists.""" + assert "license" in pyproject["project"] + license = pyproject["project"]["license"] + assert len(license) > 0 + assert license["file"] == "LICENSE" + assert Path(package_root / "LICENSE").exists() + + +def test_readme(): + """Ensure the readme is set and the file exists.""" + assert "readme" in pyproject["project"] + readme = pyproject["project"]["readme"] + assert len(readme) > 0 + assert Path(package_root / readme).exists() + + +def test_project_keys(): + """Check whether the expected keys in [project] are present.""" + project = pyproject["project"] + assert "description" in project + assert "keywords" in project + assert "classifiers" in project + assert "dependencies" in project + assert "requires-python" in project