From 019091f994c581bbadc3995a97a51488616d2f59 Mon Sep 17 00:00:00 2001 From: Alex Nicksay Date: Tue, 8 Aug 2017 04:25:39 -0400 Subject: Python: Update bro_test to reference script directly (#582) --- python/tests/_test_utils.py | 6 +++--- python/tests/bro_test.py | 14 ++++++-------- python/tests/decompressor_test.py | 0 3 files changed, 9 insertions(+), 11 deletions(-) mode change 100755 => 100644 python/tests/decompressor_test.py 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 old mode 100755 new mode 100644 -- cgit v1.1