We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 386902b + f6bbe15 commit fb91200Copy full SHA for fb91200
1 file changed
tests/test_local_sampling_benchmark.py
@@ -1,17 +1,16 @@
1
import json
2
import pkgutil
3
-from pkg_resources import resource_filename
+from pathlib import Path
4
5
# Faster
6
def test_pkgutil_static_read(benchmark):
7
def get_sampling_rule():
8
- # `.decode('utf-8')` needed for Python 3.4, 3.5
9
return json.loads(pkgutil.get_data(__name__, 'mock_sampling_rule.json').decode('utf-8'))
10
benchmark(get_sampling_rule)
11
12
# Slower
13
-def test_pkg_resources_static_read(benchmark):
+def test_pathlib_static_read(benchmark):
14
15
- with open(resource_filename(__name__, 'mock_sampling_rule.json')) as f:
+ with open(Path(__file__).parent / 'mock_sampling_rule.json') as f:
16
return json.load(f)
17
0 commit comments