diff --git a/tests/test_local_sampling_benchmark.py b/tests/test_local_sampling_benchmark.py index c98b89c7..eb76ea7d 100644 --- a/tests/test_local_sampling_benchmark.py +++ b/tests/test_local_sampling_benchmark.py @@ -1,17 +1,16 @@ import json import pkgutil -from pkg_resources import resource_filename +from pathlib import Path # Faster def test_pkgutil_static_read(benchmark): def get_sampling_rule(): - # `.decode('utf-8')` needed for Python 3.4, 3.5 return json.loads(pkgutil.get_data(__name__, 'mock_sampling_rule.json').decode('utf-8')) benchmark(get_sampling_rule) # Slower -def test_pkg_resources_static_read(benchmark): +def test_pathlib_static_read(benchmark): def get_sampling_rule(): - with open(resource_filename(__name__, 'mock_sampling_rule.json')) as f: + with open(Path(__file__).parent / 'mock_sampling_rule.json') as f: return json.load(f) benchmark(get_sampling_rule)