Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Unified Diff: test/analyzer/gyptest-analyzer.py

Issue 1454433002: Python 3 compatibility Base URL: https://chromium.googlesource.com/external/gyp.git@master
Patch Set: Rebase with master (4ec6c4e3a94bd04a6da2858163d40b2429b8aad1) Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/analyzer/gyptest-analyzer.py
diff --git a/test/analyzer/gyptest-analyzer.py b/test/analyzer/gyptest-analyzer.py
index 72de21813c1f47fe5a9af6ba199c2e8421b7c893..58a1ce6f0715b6fff6826ce4740c3f055c454962 100644
--- a/test/analyzer/gyptest-analyzer.py
+++ b/test/analyzer/gyptest-analyzer.py
@@ -6,6 +6,8 @@
"""Tests for analyzer
"""
+from __future__ import print_function
+
import json
import TestGyp
@@ -75,56 +77,56 @@ def EnsureContains(matched=False, compile_targets=set(), test_targets=set()):
"""Verifies output contains |compile_targets|."""
result = _ReadOutputFileContents()
if 'error' in result:
- print 'unexpected error', result.get('error')
+ print('unexpected error', result.get('error'))
test.fail_test()
if 'invalid_targets' in result:
- print 'unexpected invalid_targets', result.get('invalid_targets')
+ print('unexpected invalid_targets', result.get('invalid_targets'))
test.fail_test()
actual_compile_targets = set(result['compile_targets'])
if actual_compile_targets != compile_targets:
- print 'actual compile_targets:', actual_compile_targets, \
- '\nexpected compile_targets:', compile_targets
+ print('actual compile_targets:', actual_compile_targets,
+ '\nexpected compile_targets:', compile_targets)
test.fail_test()
actual_test_targets = set(result['test_targets'])
if actual_test_targets != test_targets:
- print 'actual test_targets:', actual_test_targets, \
- '\nexpected test_targets:', test_targets
+ print('actual test_targets:', actual_test_targets,
+ '\nexpected test_targets:', test_targets)
test.fail_test()
if matched and result['status'] != found:
- print 'expected', found, 'got', result['status']
+ print('expected', found, 'got', result['status'])
test.fail_test()
elif not matched and result['status'] != not_found:
- print 'expected', not_found, 'got', result['status']
+ print('expected', not_found, 'got', result['status'])
test.fail_test()
def EnsureMatchedAll(compile_targets, test_targets=set()):
result = _ReadOutputFileContents()
if 'error' in result:
- print 'unexpected error', result.get('error')
+ print('unexpected error', result.get('error'))
test.fail_test()
if 'invalid_targets' in result:
- print 'unexpected invalid_targets', result.get('invalid_targets')
+ print('unexpected invalid_targets', result.get('invalid_targets'))
test.fail_test()
if result['status'] != found_all:
- print 'expected', found_all, 'got', result['status']
+ print('expected', found_all, 'got', result['status'])
test.fail_test()
actual_compile_targets = set(result['compile_targets'])
if actual_compile_targets != compile_targets:
- print ('actual compile_targets:', actual_compile_targets,
+ print('actual compile_targets:', actual_compile_targets,
'\nexpected compile_targets:', compile_targets)
test.fail_test()
actual_test_targets = set(result['test_targets'])
if actual_test_targets != test_targets:
- print ('actual test_targets:', actual_test_targets,
+ print('actual test_targets:', actual_test_targets,
'\nexpected test_targets:', test_targets)
test.fail_test()
@@ -133,15 +135,15 @@ def EnsureError(expected_error_string):
"""Verifies output contains the error string."""
result = _ReadOutputFileContents()
if result.get('error', '').find(expected_error_string) == -1:
- print 'actual error:', result.get('error', ''), '\nexpected error:', \
- expected_error_string
+ print('actual error:', result.get('error', ''), '\nexpected error:',
+ expected_error_string)
test.fail_test()
def EnsureStdoutContains(expected_error_string):
if test.stdout().find(expected_error_string) == -1:
- print 'actual stdout:', test.stdout(), '\nexpected stdout:', \
- expected_error_string
+ print('actual stdout:', test.stdout(), '\nexpected stdout:',
+ expected_error_string)
test.fail_test()
@@ -150,8 +152,8 @@ def EnsureInvalidTargets(expected_invalid_targets):
result = _ReadOutputFileContents()
actual_invalid_targets = set(result['invalid_targets'])
if actual_invalid_targets != expected_invalid_targets:
- print 'actual invalid_targets:', actual_invalid_targets, \
- '\nexpected :', expected_invalid_targets
+ print('actual invalid_targets:', actual_invalid_targets,
+ '\nexpected :', expected_invalid_targets)
test.fail_test()

Powered by Google App Engine
This is Rietveld 408576698