Skip to content

Commit 42486d2

Browse files
committed
MNT: Add CI mode to examples
1 parent 0e95f8b commit 42486d2

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

ci/test_examples.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
for example in $(find ./examples/ -iname *.py); do
2-
python $example
2+
CI_MODE=True python $example
33
done

examples/utils.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1+
import os
12
import time
23
from collections.abc import Callable, Iterable
34
from typing import Any
45

6+
CI_MODE = os.getenv("CI_MODE", default=False)
7+
58

69
def benchmark(func: Callable, args: Iterable[Any], info: str, iters: int):
10+
if CI_MODE:
11+
print("CI mode - skipping benchmark")
12+
return
13+
714
print(info)
815
start = time.time()
916
for _ in range(iters):

0 commit comments

Comments
 (0)