Skip to content

Commit

Permalink
test: add benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKevinWeiss committed May 3, 2023
1 parent cd30ee8 commit 4e8e109
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install pytest
pip install pytest-benchmark
pip install .
- name: Run pytest
Expand Down
2 changes: 2 additions & 0 deletions pytest/test_simple_dep/app.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FOO = y
BAR = y
1 change: 1 addition & 0 deletions pytest/test_simple_dep/config.import100.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[kconfig_import("config.py") for _ in range(100)]
33 changes: 33 additions & 0 deletions pytest/test_simple_dep/test_simple_dep_bench.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import os
import glob
import kconfiglib
import pytest

CUR_DIR = os.path.dirname(os.path.realpath(__file__))


def test_bench_config(benchmark):
kconfig_path = CUR_DIR + '/Kconfig'

kconf = kconfiglib.Kconfig(kconfig_path)
benchmark(kconf.load_config, filename=CUR_DIR + '/app.config')


def test_bench_configpy(benchmark):
kconfig_path = CUR_DIR + '/Kconfig'

kconf = kconfiglib.Kconfig(kconfig_path)
benchmark(kconf.load_config, filename=CUR_DIR + '/config.py')


def test_bench_import_configpy(benchmark):
kconfig_path = CUR_DIR + '/Kconfig'

kconf = kconfiglib.Kconfig(kconfig_path)
benchmark(kconf.load_config, filename=CUR_DIR + '/config.import.py')

def test_bench_import100_configpy(benchmark):
kconfig_path = CUR_DIR + '/Kconfig'

kconf = kconfiglib.Kconfig(kconfig_path)
benchmark(kconf.load_config, filename=CUR_DIR + '/config.import100.py')

0 comments on commit 4e8e109

Please sign in to comment.