summaryrefslogtreecommitdiffstats
path: root/web/server/h2o/libh2o/deps/brotli/python/tests/test_utils.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-09 13:19:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-09 13:20:02 +0000
commit58daab21cd043e1dc37024a7f99b396788372918 (patch)
tree96771e43bb69f7c1c2b0b4f7374cb74d7866d0cb /web/server/h2o/libh2o/deps/brotli/python/tests/test_utils.py
parentReleasing debian version 1.43.2-1. (diff)
downloadnetdata-58daab21cd043e1dc37024a7f99b396788372918.tar.xz
netdata-58daab21cd043e1dc37024a7f99b396788372918.zip
Merging upstream version 1.44.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'web/server/h2o/libh2o/deps/brotli/python/tests/test_utils.py')
-rw-r--r--web/server/h2o/libh2o/deps/brotli/python/tests/test_utils.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/web/server/h2o/libh2o/deps/brotli/python/tests/test_utils.py b/web/server/h2o/libh2o/deps/brotli/python/tests/test_utils.py
new file mode 100644
index 000000000..381b64e96
--- /dev/null
+++ b/web/server/h2o/libh2o/deps/brotli/python/tests/test_utils.py
@@ -0,0 +1,36 @@
+from __future__ import print_function
+import sys
+import os
+import sysconfig
+import filecmp
+
+
+def diff_q(first_file, second_file):
+ """Simulate call to POSIX diff with -q argument"""
+ if not filecmp.cmp(first_file, second_file, shallow=False):
+ print("Files %s and %s differ" % (first_file, second_file),
+ file=sys.stderr)
+ return 1
+ return 0
+
+
+PYTHON = sys.executable or "python"
+
+# 'bro.py' script should be in parent directory
+BRO = os.path.abspath("../bro.py")
+
+# get platform- and version-specific build/lib folder
+platform_lib_name = "lib.{platform}-{version[0]}.{version[1]}".format(
+ platform=sysconfig.get_platform(),
+ version=sys.version_info)
+
+# by default, distutils' build base is in the same location as setup.py
+build_base = os.path.abspath(os.path.join("..", "..", "build"))
+build_lib = os.path.join(build_base, platform_lib_name)
+
+# prepend build/lib to PYTHONPATH environment variable
+TEST_ENV = os.environ.copy()
+if 'PYTHONPATH' not in TEST_ENV:
+ TEST_ENV['PYTHONPATH'] = build_lib
+else:
+ TEST_ENV['PYTHONPATH'] = build_lib + os.pathsep + TEST_ENV['PYTHONPATH']