-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
162 additions
and
52 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
File renamed without changes.
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,74 @@ | ||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
|
||
[project] | ||
name = "{{project-name}}" | ||
version = "0.0.1" | ||
description = "{{py_proj_desc}}" | ||
readme = "README.md" | ||
requires-python = ">=3.11" | ||
license = "MIT" | ||
authors = [ | ||
{ name = "{{gh_uname}}" }, | ||
] | ||
classifiers = [ | ||
"Development Status :: 4 - Beta", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Programming Language :: Python :: Implementation :: CPython", | ||
"Programming Language :: Python :: Implementation :: PyPy", | ||
] | ||
dependencies = [ | ||
"pytest>=8.0", | ||
"pytest-cov>=5.0", | ||
] | ||
|
||
[project.optional-dependencies] | ||
dev = [ | ||
"ruff>=0.5.0", | ||
] | ||
|
||
[project.urls] | ||
Documentation = "https://github.com/{{gh_uname}}/{{project-name}}#readme" | ||
Issues = "https://github.com/{{gh_uname}}/{{project-name}}/issues" | ||
Source = "https://github.com/{{gh_uname}}/{{project-name}}" | ||
|
||
[tool.pytest.ini_options] | ||
minversion = "6.0" | ||
addopts = [ | ||
"-ra", # show all captured stdout/stderr | ||
"-q", # quiet | ||
"--cov={{project-name}}", # report coverage of {{project-name}} | ||
"--cov-report=term-missing", # show missing coverage | ||
"--cov-report=html", # generate html coverage report | ||
"--cov-report=lcov", # generate lcov coverage report | ||
] | ||
testpaths = ["tests"] | ||
python_files = ["test_*.py", "*_test.py"] | ||
python_functions = ["test_*"] | ||
markers = [ | ||
"integration: marks tests as integration tests (deselect with '-m \"not integration\"')", | ||
] | ||
|
||
[tool.coverage.run] | ||
source_pkgs = ["{{project-name}}", "tests"] | ||
branch = true | ||
parallel = true | ||
omit = [ | ||
"*/.venv/*" | ||
] | ||
|
||
[tool.coverage.paths] | ||
{{project-name}} = ["src/{{project-name}}"] | ||
tests = ["tests"] | ||
|
||
[tool.coverage.report] | ||
exclude_lines = [ | ||
"no cov", | ||
"if __name__ == .__main__.:", | ||
"if TYPE_CHECKING:", | ||
] | ||
show_missing = true # Show missing lines in the report | ||
precision = 2 # Number of decimal places to use when rounding |
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,6 @@ | ||
target-version = "py311" | ||
line-length = 120 | ||
|
||
[lint] | ||
select = ["E", "F", "W", "C", "N", "Q", "I"] | ||
ignore = [] |
This file was deleted.
Oops, something went wrong.
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,8 @@ | ||
from .example import add, divide, multiply, subtract | ||
|
||
__all__ = [ | ||
"add", | ||
"subtract", | ||
"multiply", | ||
"divide", | ||
] |
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,16 @@ | ||
def add(a, b): | ||
return a + b | ||
|
||
|
||
def subtract(a, b): | ||
return a - b | ||
|
||
|
||
def multiply(a, b): | ||
return a * b | ||
|
||
|
||
def divide(a, b): | ||
if b == 0: | ||
raise ValueError("Division by zero is not allowed.") | ||
return a / b |
Empty file.
Empty file.
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,20 @@ | ||
import pytest | ||
from {{project-name}} import add, divide, multiply, subtract | ||
|
||
|
||
def test_add(): | ||
assert add(1, 2) == 3 | ||
|
||
|
||
def test_subtract(): | ||
assert subtract(5, 3) == 2 | ||
|
||
|
||
def test_multiply(): | ||
assert multiply(2, 3) == 6 | ||
|
||
|
||
def test_divide(): | ||
assert divide(10, 2) == 5.0 | ||
with pytest.raises(ValueError): | ||
divide(10, 0) |