summaryrefslogtreecommitdiffstats
path: root/waflib
diff options
context:
space:
mode:
Diffstat (limited to 'waflib')
-rw-r--r--waflib/extras/autowaf.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/waflib/extras/autowaf.py b/waflib/extras/autowaf.py
index 51077d1..d779967 100644
--- a/waflib/extras/autowaf.py
+++ b/waflib/extras/autowaf.py
@@ -807,11 +807,15 @@ def show_diff(from_lines, to_lines, from_filename, to_filename):
import difflib
import sys
+ same = True
for line in difflib.unified_diff(
from_lines, to_lines,
fromfile=os.path.abspath(from_filename),
tofile=os.path.abspath(to_filename)):
sys.stderr.write(line)
+ same = False
+
+ return same
def test_file_equals(patha, pathb):
import filecmp
@@ -827,9 +831,7 @@ def test_file_equals(patha, pathb):
with io.open(patha, 'rU', encoding='utf-8') as fa:
with io.open(pathb, 'rU', encoding='utf-8') as fb:
- show_diff(fa.readlines(), fb.readlines(), patha, pathb)
-
- return False
+ return show_diff(fa.readlines(), fb.readlines(), patha, pathb)
def bench_time():
if hasattr(time, 'perf_counter'): # Added in Python 3.3
@@ -888,9 +890,10 @@ class TestScope:
if 'stderr' in kwargs and kwargs['stderr'] == NONEMPTY:
# Run with a temp file for stderr and check that it is non-empty
import tempfile
- with tempfile.TemporaryFile(mode='w') as stderr:
+ with tempfile.TemporaryFile() as stderr:
kwargs['stderr'] = stderr
output = self.run(test, **kwargs)
+ stderr.seek(0, 2) # Seek to end
return (output if not output else
self.run(
lambda: stderr.tell() > 0,