-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added release information tests, prepared pyproject.toml for release
- Loading branch information
1 parent
e510e32
commit 57eff78
Showing
2 changed files
with
70 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |