summaryrefslogtreecommitdiffstats
path: root/profiler/test_for_profiler.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:21:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:21:29 +0000
commit683f1f3ddde13390781318b9fe4a6841ea35d145 (patch)
treec21fddf99f2e5233bb3f22bbafd0d711fe7c5d95 /profiler/test_for_profiler.py
parentInitial commit. (diff)
downloadpython-tomli-683f1f3ddde13390781318b9fe4a6841ea35d145.tar.xz
python-tomli-683f1f3ddde13390781318b9fe4a6841ea35d145.zip
Adding upstream version 2.0.1.upstream/2.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'profiler/test_for_profiler.py')
-rw-r--r--profiler/test_for_profiler.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/profiler/test_for_profiler.py b/profiler/test_for_profiler.py
new file mode 100644
index 0000000..0d5e079
--- /dev/null
+++ b/profiler/test_for_profiler.py
@@ -0,0 +1,24 @@
+"""Test for profiling.
+
+This test can be useful for profiling, as most of the execution time
+will be spent parsing and rendering instead of managing pytest execution
+environment. To get and read profiler results:
+ - `tox -e profile`
+ - `firefox .tox/prof/combined.svg`
+"""
+import os
+from pathlib import Path
+
+import tomli
+
+
+def test_for_profiler() -> None:
+ path = Path(__file__).parent.parent / "benchmark" / "data.toml"
+ benchmark_toml = path.read_bytes().decode()
+ # increase the count here to reduce the impact of
+ # setting up pytest execution environment. Let's keep
+ # the count low by default because this is part of the
+ # standard test suite.
+ iterations = int(os.environ.get("PROFILER_ITERATIONS", 1))
+ for _ in range(iterations):
+ tomli.loads(benchmark_toml)