diff --git a/puppetboard/core.py b/puppetboard/core.py index 4d43b7d0..43ef71a3 100644 --- a/puppetboard/core.py +++ b/puppetboard/core.py @@ -1,8 +1,8 @@ import logging import re import socket +from importlib.metadata import version -import pkg_resources from flask import Flask from flask_caching import Cache from flask_apscheduler import APScheduler @@ -70,7 +70,7 @@ def get_puppetdb(): timeout=app.config['PUPPETDB_TIMEOUT'], protocol=app.config['PUPPETDB_PROTO'], ) - requests_version = pkg_resources.get_distribution("requests").version + requests_version = version("requests") user_agent_header = { "user-agent": f"puppetboard/{own_version} (r/{requests_version})", } diff --git a/test/test_form.py b/test/test_form.py index fbc28c10..a0a44019 100644 --- a/test/test_form.py +++ b/test/test_form.py @@ -1,9 +1,13 @@ -from puppetboard import app, forms +from puppetboard import forms +from puppetboard.core import get_app + +app = get_app() +app.config['SECRET_KEY'] = 'the random string' def test_form_valid(capsys): for form in [forms.QueryForm]: - with app.app.test_request_context(): + with app.test_request_context(): qf = form() out, err = capsys.readouterr() assert qf is not None