From 80e66ad8ae7464f35d6f055cea248a19782168cb Mon Sep 17 00:00:00 2001 From: Lars Falk-Petersen Date: Wed, 20 Nov 2024 14:41:24 +0100 Subject: [PATCH] Set default site to test against in tox --- sedr/schemat.py | 8 ++++++-- sedr/test_schemat.py | 1 + sedr/util.py | 4 +--- tox.ini | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/sedr/schemat.py b/sedr/schemat.py index 8c0ad12..fac51a4 100644 --- a/sedr/schemat.py +++ b/sedr/schemat.py @@ -42,10 +42,14 @@ def set_up_schemathesis(args) -> BaseOpenAPISchema: util.logger.info("Using EDR version %s", edreq.__edr_version__) if args.openapi.startswith("http"): - util.logger.info("Testing site %s using OpenAPI spec <%s>", args.url, args.openapi) + util.logger.info( + "Testing site %s using OpenAPI spec <%s>", args.url, args.openapi + ) return schemathesis.from_uri(uri=args.openapi, base_url=args.url) - util.logger.info("Testing site %s using local OpenAPI spec at path <%s>", args.url, args.openapi) + util.logger.info( + "Testing site %s using local OpenAPI spec at path <%s>", args.url, args.openapi + ) return schemathesis.from_path(path=util.args.openapi, base_url=args.url) diff --git a/sedr/test_schemat.py b/sedr/test_schemat.py index f75099b..8d05240 100644 --- a/sedr/test_schemat.py +++ b/sedr/test_schemat.py @@ -17,5 +17,6 @@ def test_set_up_schemathesis(self): args=util.args, logfile=util.args.log_file, version=__version__ ) import schemat + schemat.schema = schemat.set_up_schemathesis(util.args) self.assertTrue(schemat.schema) diff --git a/sedr/util.py b/sedr/util.py index 62b9b0b..71a5ef4 100644 --- a/sedr/util.py +++ b/sedr/util.py @@ -23,9 +23,7 @@ def parse_args(args, version: str = "") -> argparse.Namespace: help="URL or path to openapi spec for API", default="", ) - parser.add_argument( - "--url", type=str, help="URL to API", default="" - ) + parser.add_argument("--url", type=str, help="URL to API", default="") parser.add_argument( "--iterations", type=int, diff --git a/tox.ini b/tox.ini index a35165c..0646eef 100644 --- a/tox.ini +++ b/tox.ini @@ -11,7 +11,7 @@ deps = -r{toxinidir}/requirements.txt -r{toxinidir}/requirements-dev.txt # See also config file pytest.ini -commands = python3 ./sedr/__init__.py +commands = python3 ./sedr/__init__.py --url "https://edrisobaric.k8s.met.no/" [testenv:unittest] description = Unit tests