diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-29 04:27:32 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-29 04:27:32 +0000 |
commit | 88857376d837c86ee4cbbe6ff3c9a22ab2113ffe (patch) | |
tree | efe8d5d117c400fef855ba85e3c181cd0d4bd501 /tests/test_for_profiler.py | |
parent | Initial commit. (diff) | |
download | python-tomli-w-fd3d569eafdec01529f9af7177e607be2283292d.tar.xz python-tomli-w-fd3d569eafdec01529f9af7177e607be2283292d.zip |
Adding upstream version 1.0.0.upstream/1.0.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_for_profiler.py')
-rw-r--r-- | tests/test_for_profiler.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_for_profiler.py b/tests/test_for_profiler.py new file mode 100644 index 0000000..a390980 --- /dev/null +++ b/tests/test_for_profiler.py @@ -0,0 +1,28 @@ +"""Test for profiling. + +This test can be useful for profiling, as most of the execution time +will be spent writing TOML 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 + +import tomli_w + +path = Path(__file__).parent.parent / "benchmark" / "data.toml" +benchmark_toml = path.read_bytes().decode() +data = tomli.loads(benchmark_toml) + + +def test_for_profiler(): + # 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_w.dumps(data) |