summaryrefslogtreecommitdiff
path: root/jsonschema/benchmarks
diff options
context:
space:
mode:
Diffstat (limited to 'jsonschema/benchmarks')
-rw-r--r--jsonschema/benchmarks/issue.py21
-rw-r--r--jsonschema/benchmarks/test_suite.py13
2 files changed, 8 insertions, 26 deletions
diff --git a/jsonschema/benchmarks/issue.py b/jsonschema/benchmarks/issue.py
index 825d0fc..5568ec0 100644
--- a/jsonschema/benchmarks/issue.py
+++ b/jsonschema/benchmarks/issue.py
@@ -11,20 +11,13 @@ from jsonschema.tests._suite import Collection
import jsonschema
-def main():
- runner = Runner()
- collection = Collection(
- path=FilePath(__file__).sibling("issue"),
- remotes=m(),
- name="issue",
- validator=jsonschema.Draft4Validator,
- )
- for test in collection.tests():
- runner.bench_func(
- name=test.fully_qualified_name,
- func=test.validate_ignoring_errors,
- )
+collection = Collection(
+ path=FilePath(__file__).sibling("issue"),
+ remotes=m(),
+ name="issue",
+ validator=jsonschema.Draft4Validator,
+)
if __name__ == "__main__":
- main()
+ collection.benchmark(runner=Runner())
diff --git a/jsonschema/benchmarks/test_suite.py b/jsonschema/benchmarks/test_suite.py
index 48fd0e5..c4d3ccd 100644
--- a/jsonschema/benchmarks/test_suite.py
+++ b/jsonschema/benchmarks/test_suite.py
@@ -10,16 +10,5 @@ from perf import Runner
from jsonschema.tests._suite import Suite
-def main():
- runner = Runner()
- suite = Suite()
- for collection in suite.collections():
- for test in collection.tests():
- runner.bench_func(
- name=test.fully_qualified_name,
- func=test.validate_ignoring_errors,
- )
-
-
if __name__ == "__main__":
- main()
+ Suite().benchmark(runner=Runner())