Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com>
  • Loading branch information
santacodes and agriyakhetarpal authored Jul 27, 2024
1 parent ef3ef2f commit fd76ebc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"backend": {
"__prompt__": "Choose a build backend",
"hatch": "Hatchling (recommended for pure Python projects)",
"vcs": "Enable hatch version control (vcs)?"
"vcs": "Let hatch get the version from your version control system (Git/Mercurial/SVN)?"
},
"mypy": "Use mypy and static types"
}
Expand Down
1 change: 1 addition & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def run_template_generation(session):
session.install("-e", ".[dev]", silent=False)
session.run("pytest", "tests/template_tests")


@nox.session(name="project-tests")
def run_project_tests(session):
"""Run the tests for testing template generation"""
Expand Down
4 changes: 4 additions & 0 deletions {{cookiecutter.project_name}}/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,31 @@ def build_docs(session: nox.Session) -> None:
"build/html/",
)


@nox.session(name="generated-project-tests")
def run_generated_project_tests(session):
"""Run the tests for testing units inside generated project"""
session.install("setuptools", silent=False)
session.install("-e", ".[dev]", silent=False)
session.run("pytest", "tests/generated_project_tests")


@nox.session(name="user-tests")
def run_user_tests(session):
"""Run the tests for testing user written tests"""
session.install("setuptools", silent=False)
session.install("-e", ".[dev]", silent=False)
session.run("pytest", "tests/user_tests")


@nox.session(name="coverage")
def run_coverage(session):
"""Run the coverage tests and generate an XML report."""
session.posargs.append("--cov=src/pybamm_cookiecutter")
session.posargs.append("--cov-report=xml")
run_user_tests(session)


@nox.session(name="dev")
def set_dev(session):
"""Install pybamm-cookiecutter in editable mode"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_parameter_sets_entry_point_load():
sys.modules["Chen2020mod"] = chen_module
spec.loader.exec_module(chen_module)
parameters_from_file = chen_module.get_parameter_values()
assert parameters.keys() == parameters_from_file.keys(), f"The keys in the module and local input file are not the same, expected {parameters.keys} got {parameters_from_file.keys()}"
assert parameters.keys() == parameters_from_file.keys(), f"The keys in the module and local input file are not the same, expected {parameters.keys}, got {parameters_from_file.keys()}"

def test_model_entry_points():
"""Test if the models via entry points are loaded correctly."""
Expand All @@ -38,6 +38,7 @@ def test_model_entry_points():

assert models == entry_points, "Entry points missing either in pyproject.toml or in the input directory"


def test_model_entry_point_load():
"""Testing if the model gets initialised and returned."""
# Loading parameter_sets through entry points
Expand Down

0 comments on commit fd76ebc

Please sign in to comment.