aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorAlex Nicksay <nicksay@google.com>2017-08-08 04:25:39 -0400
committerEugene Kliuchnikov <eustas@google.com>2017-08-08 10:25:39 +0200
commit019091f994c581bbadc3995a97a51488616d2f59 (patch)
tree303bed078b77746c762ee3322ed086ff792f83aa /python
parent3917011ddb074a430fc7501517fe3cb551fb3385 (diff)
downloadbrotli-019091f994c581bbadc3995a97a51488616d2f59.zip
brotli-019091f994c581bbadc3995a97a51488616d2f59.tar.gz
brotli-019091f994c581bbadc3995a97a51488616d2f59.tar.bz2
Python: Update bro_test to reference script directly (#582)
Diffstat (limited to 'python')
-rw-r--r--python/tests/_test_utils.py6
-rw-r--r--python/tests/bro_test.py14
-rw-r--r--[-rwxr-xr-x]python/tests/decompressor_test.py0
3 files changed, 9 insertions, 11 deletions
diff --git a/python/tests/_test_utils.py b/python/tests/_test_utils.py
index e38edd3..104e654 100644
--- a/python/tests/_test_utils.py
+++ b/python/tests/_test_utils.py
@@ -13,9 +13,9 @@ project_dir = os.path.abspath(os.path.join(__file__, '..', '..', '..'))
src_dir = os.path.join(project_dir, 'python')
test_dir = os.path.join(project_dir, 'tests')
-PYTHON = sys.executable or 'python'
-
-BRO = os.path.join(src_dir, 'bro.py')
+python_exe = sys.executable or 'python'
+bro_path = os.path.join(src_dir, 'bro.py')
+BRO_ARGS = [python_exe, bro_path]
# Get the platform/version-specific build folder.
# By default, the distutils build base is in the same location as setup.py.
diff --git a/python/tests/bro_test.py b/python/tests/bro_test.py
index c0d55dc..b55129d 100644
--- a/python/tests/bro_test.py
+++ b/python/tests/bro_test.py
@@ -9,8 +9,7 @@ import unittest
from . import _test_utils
import brotli
-PYTHON = _test_utils.PYTHON
-BRO = _test_utils.BRO
+BRO_ARGS = _test_utils.BRO_ARGS
TEST_ENV = _test_utils.TEST_ENV
@@ -28,13 +27,12 @@ class TestBroDecompress(_test_utils.TestCase):
def _decompress_file(self, test_data):
temp_uncompressed = _test_utils.get_temp_uncompressed_name(test_data)
- args = [PYTHON, BRO, '-f', '-d', '-i', test_data, '-o',
- temp_uncompressed]
+ args = BRO_ARGS + ['-f', '-d', '-i', test_data, '-o', temp_uncompressed]
subprocess.check_call(args, env=TEST_ENV)
def _decompress_pipe(self, test_data):
temp_uncompressed = _test_utils.get_temp_uncompressed_name(test_data)
- args = [PYTHON, BRO, '-d']
+ args = BRO_ARGS + ['-d']
with open(temp_uncompressed, 'wb') as out_file:
with open(test_data, 'rb') as in_file:
subprocess.check_call(
@@ -61,14 +59,14 @@ class TestBroCompress(_test_utils.TestCase):
temp_uncompressed = _test_utils.get_temp_uncompressed_name(test_data)
temp_compressed = _test_utils.get_temp_compressed_name(test_data)
original = test_data
- args = [PYTHON, BRO, '-f', '-d']
+ args = BRO_ARGS + ['-f', '-d']
args.extend(['-i', temp_compressed, '-o', temp_uncompressed])
subprocess.check_call(args, env=TEST_ENV)
self.assertFilesMatch(temp_uncompressed, original)
def _compress_file(self, test_data, **kwargs):
temp_compressed = _test_utils.get_temp_compressed_name(test_data)
- args = [PYTHON, BRO, '-f']
+ args = BRO_ARGS + ['-f']
if 'quality' in kwargs:
args.extend(['-q', str(kwargs['quality'])])
if 'lgwin' in kwargs:
@@ -78,7 +76,7 @@ class TestBroCompress(_test_utils.TestCase):
def _compress_pipe(self, test_data, **kwargs):
temp_compressed = _test_utils.get_temp_compressed_name(test_data)
- args = [PYTHON, BRO]
+ args = BRO_ARGS
if 'quality' in kwargs:
args.extend(['-q', str(kwargs['quality'])])
if 'lgwin' in kwargs:
diff --git a/python/tests/decompressor_test.py b/python/tests/decompressor_test.py
index afa127f..afa127f 100755..100644
--- a/python/tests/decompressor_test.py
+++ b/python/tests/decompressor_test.py