Skip to content

Commit

Permalink
perf: Add 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 15, 2024
1 parent 5f59563 commit 0a075c6
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions benches/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,50 @@ def test_get_all_operations(raw_schema):
pass


@pytest.mark.benchmark
@pytest.mark.parametrize(
"raw_schema, key",
[
(BBCI, ("/categories", "get")),
(VMWARE, ("/entities/problems", "get")),
],
ids=("bbci", "vmware"),
)
def test_get_operation(raw_schema, key):
schema = schemathesis.from_dict(raw_schema)
current = schema
for segment in key:
current = current[segment]


@pytest.mark.benchmark
@pytest.mark.parametrize(
"raw_schema, key",
[
(BBCI, "Get_Categories_"),
(VMWARE, "listProblemEvents"),
],
ids=("bbci", "vmware"),
)
def test_get_operation_by_id(raw_schema, key):
schema = schemathesis.from_dict(raw_schema)
_ = schema.get_operation_by_id(key)


@pytest.mark.benchmark
@pytest.mark.parametrize(
"raw_schema, key",
[
(BBCI, "#/paths/~1categories/get"),
(VMWARE, "#/paths/~1entities~1problems/get"),
],
ids=("bbci", "vmware"),
)
def test_get_operation_by_reference(raw_schema, key):
schema = schemathesis.from_dict(raw_schema)
_ = schema.get_operation_by_reference(key)


@pytest.mark.benchmark
@pytest.mark.parametrize("operations", [BBCI_OPERATIONS, VMWARE_OPERATIONS], ids=("bbci", "vmware"))
def test_as_json_schema(operations):
Expand Down

0 comments on commit 0a075c6

Please sign in to comment.