Skip to content

Commit

Permalink
Set default site to test against in tox
Browse files Browse the repository at this point in the history
  • Loading branch information
ways committed Nov 20, 2024
1 parent 369e223 commit 80e66ad
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
8 changes: 6 additions & 2 deletions sedr/schemat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
1 change: 1 addition & 0 deletions sedr/test_schemat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 1 addition & 3 deletions sedr/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 80e66ad

Please sign in to comment.