Added TOML settings file and .coveragerc file.

master v0.2.0
androiddrew 6 years ago
parent 85237a5ccc
commit 46671d09fb

@ -20,7 +20,7 @@ $ pip-sync dev_requirements.txt requirements.txt
```
#### Run tests
```
$ pytest -v
$ export ENVIRONMENT=test && pytest -v
```
#### Using the management script
@ -44,5 +44,8 @@ MIT Licensed.
## Changelog
### 0.2.0 (01/15/2019)
- Added TOML settings file and .coveragerc file
### 0.1.0 (12/09/2018)
- Initial release

@ -0,0 +1,6 @@
[run]
source = {{cookiecutter.project_slug}}
omit = test*
[report]
show_missing = True

@ -21,7 +21,7 @@ def delete_todo(todo_id: int, todo_manager: TodoManager):
todo_manager.delete_todo(todo_id)
return (
HTTP_202,
APIResponse(status=202, message=f"Delete request for store: {todo_id} accepted"),
APIResponse(status=202, message=f"Delete request for todo: {todo_id} accepted"),
)

@ -3,14 +3,14 @@ from typing import Tuple
from molten import App, Route, ResponseRendererMiddleware
from molten.http import HTTP_404, Request
from molten.openapi import Metadata, OpenAPIHandler, OpenAPIUIHandler
from molten.settings import Settings, SettingsComponent
from molten.settings import SettingsComponent
from molten.contrib.sqlalchemy import SQLAlchemyMiddleware, SQLAlchemyEngineComponent, SQLAlchemySessionComponent
from .api.welcome import welcome
from .api.todo import TodoManagerComponent, todo_routes
from .common import ExtJSONRenderer
from .schema import APIResponse
from .settings import SETTINGS
get_schema = OpenAPIHandler(
metadata=Metadata(
@ -22,20 +22,8 @@ get_schema = OpenAPIHandler(
get_docs = OpenAPIUIHandler()
settings = Settings(
{
"database_engine_dsn": os.getenv(
"DATABASE_DSN", "postgresql://molten:local@localhost/cookiecutter"
),
"database_engine_params": {
"echo": True,
"connect_args": {"options": "-c timezone=utc"},
},
}
)
components = [
SettingsComponent(settings),
SettingsComponent(SETTINGS),
SQLAlchemyEngineComponent(),
SQLAlchemySessionComponent(),
TodoManagerComponent(),

@ -0,0 +1,12 @@
import os
from molten.contrib.toml_settings import TOMLSettings
from .common import path_to
ENVIRONMENT = os.getenv("ENVIRONMENT", "dev")
SETTINGS = TOMLSettings.from_path(path_to("settings.toml"), ENVIRONMENT)
def __getattr__(name):
return getattr(SETTINGS, name)

@ -0,0 +1,10 @@
[common]
database_engine_dsn = "postgresql://molten:local@localhost/cookiecutter"
[dev]
database_engine_params.echo = true
database_engine_params.connect_args.options = "-c timezone=utc"
[test]
database_engine_dsn = "postgresql://molten:local@localhost/test_cookiecutter"
database_engine_params.echo = true
Loading…
Cancel
Save