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

Refactored scripts to start using a common file

Commit
2278451cd22b69d6c18f6e42378df6bd2c549c51
Author
Phil Nash ·
Parents
1309da2b553d

Files · Download .tar.gz

Changes

 scripts/approvalTests.py        | 13 ++++++++-----
 scripts/approve.py              |  7 ++++---
 scripts/generateSingleHeader.py |  7 ++++---
 scripts/scriptCommon.py         |  4 ++++
 4 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/scripts/approvalTests.py b/scripts/approvalTests.py
index 1bf114af..14a5354e 100644
--- a/scripts/approvalTests.py
+++ b/scripts/approvalTests.py
@@ -3,18 +3,21 @@ import sys
 import subprocess
 import re
 
+from scriptCommon import catchPath
+
 filenameParser = re.compile( r'\s*.*/(.*\..pp)(.*)' )
 hexParser = re.compile( r'(.*)\b(0[xX][0-9a-fA-F]+)\b(.*)' )
 
-catchPath = os.path.realpath(os.path.dirname(sys.argv[0]))
-baselinesPath = os.path.join( catchPath, '../projects/SelfTest/Baselines/approvedResults.txt' )
-rawResultsPath = os.path.join( catchPath, '../projects/SelfTest/Baselines/_rawResults.tmp' )
-filteredResultsPath = os.path.join( catchPath, '../projects/SelfTest/Baselines/unapprovedResults.txt' )
+#catchPath = os.path.dirname(os.path.realpath( os.path.dirname(sys.argv[0])))
+
+baselinesPath = os.path.join( catchPath, 'projects/SelfTest/Baselines/approvedResults.txt' )
+rawResultsPath = os.path.join( catchPath, 'projects/SelfTest/Baselines/_rawResults.tmp' )
+filteredResultsPath = os.path.join( catchPath, 'projects/SelfTest/Baselines/unapprovedResults.txt' )
 
 if len(sys.argv) == 2:
 	cmdPath = sys.argv[1]
 else:
-	cmdPath = "../projects/XCode4/CatchSelfTest/DerivedData/CatchSelfTest/Build/Products/Debug/CatchSelfTest"
+	cmdPath = os.path.join( catchPath, 'projects/XCode4/CatchSelfTest/DerivedData/CatchSelfTest/Build/Products/Debug/CatchSelfTest' )
 
 f = open( rawResultsPath, 'w' )
 subprocess.call([ cmdPath, "~dummy", "-s", "-w", "NoAssertions", "-r", "console" ], stdout=f, stderr=f )
diff --git a/scripts/approve.py b/scripts/approve.py
index 25a566b4..9302ae56 100644
--- a/scripts/approve.py
+++ b/scripts/approve.py
@@ -2,9 +2,10 @@ import os
 import sys
 import shutil
 
-catchPath = os.path.realpath(os.path.dirname(sys.argv[0]))
-baselinesPath = os.path.join( catchPath, '../projects/SelfTest/Baselines/approvedResults.txt' )
-filteredResultsPath = os.path.join( catchPath, '../projects/SelfTest/Baselines/unapprovedResults.txt' )
+from scriptCommon import catchPath
+
+baselinesPath = os.path.join( catchPath, 'projects/SelfTest/Baselines/approvedResults.txt' )
+filteredResultsPath = os.path.join( catchPath, 'projects/SelfTest/Baselines/unapprovedResults.txt' )
 
 if os.path.isfile( filteredResultsPath ):
 	os.remove( baselinesPath )
diff --git a/scripts/generateSingleHeader.py b/scripts/generateSingleHeader.py
index 85b24ec6..0301cd63 100644
--- a/scripts/generateSingleHeader.py
+++ b/scripts/generateSingleHeader.py
@@ -3,6 +3,8 @@ import sys
 import re
 import datetime
 
+from scriptCommon import catchPath
+
 versionParser = re.compile( r'(\s*Version\slibraryVersion)\s*\(\s*(.*)\s*,\s*(.*)\s*,\s*(.*)\s*,\s*\"(.*)\"\s*\).*' )
 includesParser = re.compile( r'\s*#include\s*"(.*)"' )
 guardParser = re.compile( r'\s*#.*_INCLUDED')
@@ -11,10 +13,9 @@ commentParser1 = re.compile( r'^\s*/\*')
 commentParser2 = re.compile( r'^\s*\*')
 blankParser = re.compile( r'^\s*$')
 seenHeaders = set([])
-catchPath = os.path.realpath(os.path.dirname(sys.argv[0]))
-rootPath = os.path.join( catchPath, '../include/' )
+rootPath = os.path.join( catchPath, 'include/' )
 versionPath = os.path.join( rootPath, "internal/catch_version.hpp" )
-readmePath = os.path.join( catchPath, "../README.md" )
+readmePath = os.path.join( catchPath, "README.md" )
 #outputPath = os.path.join( catchPath, 'single_include/catch.hpp' )
 
 bumpVersion = len(sys.argv) < 2 or sys.argv[1] <> "nobump"
diff --git a/scripts/scriptCommon.py b/scripts/scriptCommon.py
new file mode 100644
index 00000000..5710ba9c
--- /dev/null
+++ b/scripts/scriptCommon.py
@@ -0,0 +1,4 @@
+import os
+import sys
+
+catchPath = os.path.dirname(os.path.realpath( os.path.dirname(sys.argv[0])))
\ No newline at end of file