Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Fix python scripts for python 3 (print now a function rather than a keyword)

Commit
77c9edfcdbde6f98b799784fc8d13ebfaf5c35ce
Author
Martin Moene ·
Parents
91ea20c4cc80

Files · Download .tar.gz

Changes

 scripts/approvalTests.py        | 16 +++++++++-------
 scripts/approve.py              |  8 +++++---
 scripts/generateSingleHeader.py | 10 ++++++----
 3 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/scripts/approvalTests.py b/scripts/approvalTests.py
index 77b92657..5db26d77 100644
--- a/scripts/approvalTests.py
+++ b/scripts/approvalTests.py
@@ -1,3 +1,5 @@
+from  __future__ import  print_function
+
 import os
 import sys
 import subprocess
@@ -66,20 +68,20 @@ def approve( baseName, args ):
 	rawFile.close()
 
 	os.remove( rawResultsPath )
-	print
-	print baseName + ":"
+	print()
+	print( baseName + ":" )
 	if os.path.exists( baselinesPath ):
 		diffResult = subprocess.call([ "diff", baselinesPath, filteredResultsPath ] )
 		if diffResult == 0:
 			os.remove( filteredResultsPath )
-			print "  \033[92mResults matched"
+			print( "  \033[92mResults matched" )
 		else:
-			print "  \n****************************\n  \033[91mResults differed"
+			print( "  \n****************************\n  \033[91mResults differed" )
 			if diffResult > overallResult:
 				overallResult = diffResult
-		print "\033[0m"
+		print( "\033[0m" )
 	else:
-		print "  first approval"
+		print( "  first approval" )
 		if overallResult == 0:
 			overallResult = 1
 
@@ -95,5 +97,5 @@ approve( "junit.sw", ["~_", "-s", "-w", "NoAssertions", "-r", "junit"] )
 approve( "xml.sw", ["~_", "-s", "-w", "NoAssertions", "-r", "xml"] )
 
 if overallResult != 0:
-	print "run approve.py to approve new baselines"
+	print( "run approve.py to approve new baselines" )
 exit( overallResult)
diff --git a/scripts/approve.py b/scripts/approve.py
index 7801b546..f4b66aa4 100644
--- a/scripts/approve.py
+++ b/scripts/approve.py
@@ -1,3 +1,5 @@
+from  __future__ import  print_function
+
 import os
 import sys
 import shutil
@@ -18,12 +20,12 @@ def approveFile( approvedFile, unapprovedFile ):
 		if os.path.exists( approvedFile ):
 			os.remove( approvedFile )
 		os.rename( unapprovedFile, approvedFile )
-		print "approved " + justFilename		
+		print( "approved " + justFilename )
 	else:
-		print "approval file " + justFilename + " does not exist"
+		print( "approval file " + justFilename + " does not exist" )
 
 if len(files) > 0:
 	for unapprovedFile in files:
 		approveFile( unapprovedFile.replace( "unapproved.txt", "approved.txt" ), unapprovedFile )
 else:
-	print "no files to approve"
\ No newline at end of file
+	print( "no files to approve" )
diff --git a/scripts/generateSingleHeader.py b/scripts/generateSingleHeader.py
index 8930c45e..dda16305 100644
--- a/scripts/generateSingleHeader.py
+++ b/scripts/generateSingleHeader.py
@@ -1,3 +1,5 @@
+from  __future__ import  print_function
+
 import os
 import sys
 import re
@@ -33,9 +35,9 @@ for arg in sys.argv[1:]:
     elif arg == "noimpl":
         includeImpl = False
         bumpVersion = False
-        print "Not including impl code (and not bumping version)"
+        print( "Not including impl code (and not bumping version)" )
     else:
-        print "\n** Unrecognised argument: " + arg + " **\n"
+        print( "\n** Unrecognised argument: " + arg + " **\n" )
         exit(1)
 
 out = open( outputPath, 'w' )
@@ -144,9 +146,9 @@ def generateSingleInclude():
     out.write( " */\n" )
     out.write( "#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )
     out.write( "#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )
-    
+
     parseFile( rootPath, 'catch.hpp' )
-    
+
     out.write( "#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n\n" )
 
 generateSingleInclude()