Skip to content

Commit 1c91ab8

Browse files
ebardsleyDouglas Greiman
authored andcommitted
Fix tests on MacOS. (google#77)
Two issues: - BSD head/tail don't support the +/- specifications. Use "-q -q" to unzip instead to remove headers and footers. - "python2" isn't guaranteed to exist. Use the current interpreter.
1 parent 47ff664 commit 1c91ab8

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

compiler/python_archive_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import os
1616
import subprocess
17+
import sys
1718
import time
1819
import unittest
1920
import zipfile
@@ -45,7 +46,7 @@ def setUp(self):
4546
if not os.path.exists(self.output_dir):
4647
os.makedirs(self.output_dir)
4748
self.output_filename = os.path.join(self.output_dir, 'output.par')
48-
self.interpreter = '/usr/bin/python2'
49+
self.interpreter = sys.executable
4950
self.import_roots = []
5051
self.date_time_tuple = (1980, 1, 1, 0, 0, 0)
5152
self.timestamp = 315532800

tests/test_harness.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ TMP_EXECUTABLE="$TEST_TMPDIR"/$(basename "$EXECUTABLE")
4141
# Compare list of files in zipfile with expected list
4242
if [ "$PAR" -eq 1 ]; then
4343
diff \
44-
<(unzip -l "$EXECUTABLE" | awk '{print $NF}' | head -n -2 | tail -n +4) \
44+
<(unzip -l -q -q "$EXECUTABLE" | awk '{print $NF}') \
4545
"$FILELIST" \
4646
|| die 'FATAL: zipfile contents do not match expected'
4747
fi

0 commit comments

Comments
 (0)