Skip to content
Merged
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ classifiers = [
"Typing :: Typed",
]
dynamic = ["version"]
dependencies = ["pybamm"]
dependencies = ["pybamm", "cookiecutter"]

[project.optional-dependencies]
dev = [
"pytest >=6",
"pytest-cov >=3",
"nox",
"pre-commit",
"pytest-cookies",
]
docs = [
"sphinx",
Expand Down
7 changes: 6 additions & 1 deletion src/pybamm_cookiecutter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
"""
from __future__ import annotations

import pybamm

from ._version import version as __version__

__all__ : tuple[str] = ("__version__",)
__all__ : list[str] = [
"__version__",
"pybamm",
]
5 changes: 0 additions & 5 deletions tests/test_package.py

This file was deleted.

31 changes: 31 additions & 0 deletions tests/test_project_generation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import pybamm_cookiecutter as m
import pytest

def test_version() -> None:
assert m.__version__

@pytest.fixture
def custom_template(tmpdir):
"""
Generating a project using the template into a tempdir
"""
template = tmpdir.ensure("cookiecutter-template", dir=True)
template.join("cookiecutter.json").write('{"project_name": "pybamm_cookie"}')

repo_dir = template.ensure("{{cookiecutter.project_name}}", dir=True)
repo_dir.join("README.rst").write("{{cookiecutter.project_name}}")

return template


def test_bake_custom_project(cookies, custom_template):
"""
Testing if the projects exists in the tempdir
"""
result = cookies.bake(template=str(custom_template))

assert result.exit_code == 0
assert result.exception is None

assert result.project_path.name == "pybamm_cookie"
assert result.project_path.is_dir()