Skip to content

Commit

Permalink
perf: More benchmarks
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Dygalo <dmitry@dygalo.dev>
  • Loading branch information
Stranger6667 committed May 16, 2024
1 parent 6fce0e3 commit 9137858
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions benches/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ def test_get_all_operations(raw_schema):
pass


@pytest.mark.benchmark
@pytest.mark.parametrize("raw_schema", [BBCI, VMWARE], ids=("bbci", "vmware"))
def test_length(raw_schema):
schema = schemathesis.from_dict(raw_schema)
_ = len(schema)


# Schemas with pre-populated cache
BBCI_OPERATION_ID = "Get_Categories_"
BBCI_OPERATION_KEY = ("/categories", "get")
Expand Down
4 changes: 2 additions & 2 deletions src/schemathesis/specs/openapi/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def get_all_operations(
continue
self.dispatch_hook("before_process_path", context, path, path_item)
scope, path_item = self._resolve_path_item(path_item)
common_parameters = self.resolver.resolve_all(
shared_parameters = self.resolver.resolve_all(
path_item.get("parameters", []), RECURSION_DEPTH_LIMIT - 8
)
for method, definition in path_item.items():
Expand All @@ -256,7 +256,7 @@ def get_all_operations(
if self._should_skip(method, resolved_definition):
continue
parameters = self.collect_parameters(
itertools.chain(resolved_definition.get("parameters", ()), common_parameters),
itertools.chain(resolved_definition.get("parameters", ()), shared_parameters),
resolved_definition,
)
# To prevent recursion errors we need to pass not resolved schema as well
Expand Down

0 comments on commit 9137858

Please sign in to comment.