Skip to content

Commit

Permalink
tests: add tests for hatch env (#33)
Browse files Browse the repository at this point in the history
* tests: add tests for hatch env

Signed-off-by: Henry Schreiner <[email protected]>

* style: pre-commit fixes

---------

Signed-off-by: Henry Schreiner <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
henryiii and pre-commit-ci[bot] authored Apr 20, 2024
1 parent 9a1e94c commit 353a7a8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ test = [
"pytest >=6",
"pytest-cov >=3",
"validate-pyproject>=0.16",
"tomli; python_version<'3.11'",
]
docs = [
"sphinx>=7.0",
Expand Down
35 changes: 28 additions & 7 deletions tests/test_validate_pyproject.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,40 @@
from __future__ import annotations

import sys

from validate_pyproject import api

if sys.version_info < (3, 11):
import tomli as tomllib
else:
import tomllib


def test_vpp_loads(caplog):
pyproject_as_dict = {
"tool": {
"ruff": {
"src": ["src"],
}
}
}
pyproject_as_dict = tomllib.loads("""
[tool.ruff]
src = ["src"]
""")

validator = api.Validator()
validator(pyproject_as_dict)
assert (
"validate_pyproject_schema_store.schema.get_schema defines `tool.poetry` schema"
in caplog.text
)


def test__loads(caplog):
pyproject_as_dict = tomllib.loads("""
[tool.hatch.env]
requires = [
"hatch-pip-compile"
]
""")

validator = api.Validator()
validator(pyproject_as_dict)
assert (
"validate_pyproject_schema_store.schema.get_schema defines `tool.hatch` schema"
in caplog.text
)

0 comments on commit 353a7a8

Please sign in to comment.