feat: agregar template base de Python con tests
This commit is contained in:
parent
584a4fe42b
commit
3853586abf
19
README.md
19
README.md
@ -1,3 +1,22 @@
|
||||
# FieldTest
|
||||
|
||||
Datos: creado desde Hermes con tea CLI.
|
||||
|
||||
## Template Python
|
||||
|
||||
Estructura base incluida:
|
||||
|
||||
- `src/fieldtest/` paquete principal
|
||||
- `tests/` pruebas unitarias (unittest)
|
||||
- `pyproject.toml` configuración de empaquetado
|
||||
- `.gitignore` y `LICENSE`
|
||||
|
||||
## Uso rápido
|
||||
|
||||
Ejecutar pruebas:
|
||||
|
||||
`PYTHONPATH=src python3 -m unittest discover -s tests -v`
|
||||
|
||||
Ejecutar módulo:
|
||||
|
||||
`PYTHONPATH=src python3 -m fieldtest`
|
||||
|
||||
30
pyproject.toml
Normal file
30
pyproject.toml
Normal file
@ -0,0 +1,30 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=69", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "fieldtest"
|
||||
version = "0.1.0"
|
||||
description = "Plantilla base de proyecto Python creada desde Hermes"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.10"
|
||||
authors = [
|
||||
{ name = "deimo72" }
|
||||
]
|
||||
license = { text = "MIT" }
|
||||
keywords = ["template", "python", "fieldtest"]
|
||||
classifiers = [
|
||||
"Programming Language :: Python :: 3",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Operating System :: OS Independent"
|
||||
]
|
||||
|
||||
[tool.setuptools]
|
||||
package-dir = {"" = "src"}
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
where = ["src"]
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
testpaths = ["tests"]
|
||||
pythonpath = ["src"]
|
||||
5
src/fieldtest/__init__.py
Normal file
5
src/fieldtest/__init__.py
Normal file
@ -0,0 +1,5 @@
|
||||
"""Paquete base FieldTest."""
|
||||
|
||||
from .core import saludar
|
||||
|
||||
__all__ = ["saludar"]
|
||||
9
src/fieldtest/__main__.py
Normal file
9
src/fieldtest/__main__.py
Normal file
@ -0,0 +1,9 @@
|
||||
from .core import saludar
|
||||
|
||||
|
||||
def main() -> None:
|
||||
print(saludar("desde FieldTest"))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
3
src/fieldtest/core.py
Normal file
3
src/fieldtest/core.py
Normal file
@ -0,0 +1,3 @@
|
||||
def saludar(nombre: str = "mundo") -> str:
|
||||
"""Retorna un saludo simple."""
|
||||
return f"Hola, {nombre}!"
|
||||
15
tests/test_core.py
Normal file
15
tests/test_core.py
Normal file
@ -0,0 +1,15 @@
|
||||
import unittest
|
||||
|
||||
from fieldtest.core import saludar
|
||||
|
||||
|
||||
class TestCore(unittest.TestCase):
|
||||
def test_saludar_default(self):
|
||||
self.assertEqual(saludar(), "Hola, mundo!")
|
||||
|
||||
def test_saludar_nombre(self):
|
||||
self.assertEqual(saludar("Hermes"), "Hola, Hermes!")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Loading…
Reference in New Issue
Block a user