bocadilloproject/aiodine

Auto-used providers

Closed this issue · 0 comments

Auto-used providers are activated without needing to declare them in the views.

@aiodine.provider(autouse=True, scope="session")
def testing_env():
    initial = os.environ.get("ENV")
    os.environ["ENV"] = "TESTING"
    yield
    os.environ.pop("ENV")
    if initial is not None:
        os.environ["ENV"] = initial