diff options
author | David Robillard <d@drobilla.net> | 2019-04-13 11:40:37 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-04-13 11:40:37 +0200 |
commit | e3999d33c0347ca000fdafc2e9169701a9d69e0f (patch) | |
tree | cf803b73938d32e790ba1e0fd7c90b59b26dd7d5 /extras | |
parent | 8cb9c6430dc0056f8d40b4d8e0bdc616ff397e1f (diff) | |
download | ganv-e3999d33c0347ca000fdafc2e9169701a9d69e0f.tar.gz ganv-e3999d33c0347ca000fdafc2e9169701a9d69e0f.tar.bz2 ganv-e3999d33c0347ca000fdafc2e9169701a9d69e0f.zip |
Squashed 'waflib/' changes from e7a29b6..cddbcb5
cddbcb5 Pass file comparison test if difflib finds no changes
6e4e92b Seek to end before checking the size of stderr output
git-subtree-dir: waflib
git-subtree-split: cddbcb577dad255414b6454d8680a6cd80ad7458
Diffstat (limited to 'extras')
-rw-r--r-- | extras/autowaf.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/extras/autowaf.py b/extras/autowaf.py index 51077d1..d779967 100644 --- a/extras/autowaf.py +++ b/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, |