Skip to content

Commit aa4b2f5

Browse files
committed
Benchmark tests should both consistently return
1 parent 8ad460e commit aa4b2f5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/test_local_sampling_benchmark.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
import pkgutil
33
from pkg_resources import resource_filename
44

5-
from aws_xray_sdk.core.sampling.local.sampler import LocalSampler
5+
# Faster
6+
def test_pkgutil_static_read(benchmark):
7+
def get_sampling_rule():
8+
return json.loads(pkgutil.get_data(__name__, 'mock_sampling_rule.json'))
9+
benchmark(get_sampling_rule)
610

11+
# Slower
712
def test_pkg_resources_static_read(benchmark):
813
def get_sampling_rule():
914
with open(resource_filename(__name__, 'mock_sampling_rule.json')) as f:
1015
return json.load(f)
1116
benchmark(get_sampling_rule)
12-
13-
def test_pkgutil_static_read(benchmark):
14-
def get_sampling_rule():
15-
json.loads(pkgutil.get_data(__name__, 'mock_sampling_rule.json'))
16-
benchmark(get_sampling_rule)

0 commit comments

Comments
 (0)