fix quality warning + commit messages unittest

This commit is contained in:
cclecle
2023-03-19 10:03:50 +00:00
parent cefa964a3a
commit 63b3f25b33
2 changed files with 22 additions and 17 deletions

View File

@@ -1235,7 +1235,7 @@ class Test_gitversionhelper(unittest.TestCase):
pygitversionhelper.gitversionhelper.commit.getFromTag("TAG")
def test_nominal__commit_getMessage(self):
commit_message="AAAABBB CCCCDDDD"
commit_message="AAAABBB CCCCDDDD".replace('\r\n','\n').replace('\n','\r\n')
with open("demofile.txt", "w+t") as tmpFile:
tmpFile.write("testvalue")
os.system("git add .")
@@ -1247,7 +1247,8 @@ class Test_gitversionhelper(unittest.TestCase):
def test_nominal__commit_getMessage2(self):
commit_message="""AAAABBB
CCCCDDDD
-f dfsds dfsdfs $"""
-f dfsds dfsdfs $""".replace('\r\n','\n').replace('\n','\r\n')
with open("demofile.txt", "w+t") as tmpFile:
tmpFile.write("testvalue")
os.system("git add .")
@@ -1258,13 +1259,14 @@ class Test_gitversionhelper(unittest.TestCase):
commit = pygitversionhelper.gitversionhelper.commit.getLast()
message = pygitversionhelper.gitversionhelper.commit.getMessage(commit)
print(message)
self.assertEqual(message,commit_message)
def test_nominal__commit_getMessagesSinceLastTag(self):
commit_message1="1.1 update this"+ os.linesep+\
"1.1 fix that" + os.linesep+\
"1.1 test"
commit_message1=commit_message1.replace('\r\n','\n').replace('\n','\r\n')
with open("demofile.txt", "w+t") as tmpFile:
tmpFile.write("testvalue")
os.system("git add .")
@@ -1277,6 +1279,7 @@ class Test_gitversionhelper(unittest.TestCase):
commit_message2="2.1 update this"+ os.linesep+\
"2.1 fix that" + os.linesep+\
"2.1 test"
commit_message2=commit_message2.replace('\r\n','\n').replace('\n','\r\n')
with open("demofile.txt", "w+t") as tmpFile:
tmpFile.write("testvalue2")
os.system("git add .")
@@ -1288,6 +1291,7 @@ class Test_gitversionhelper(unittest.TestCase):
commit_message3="3.1 update this"+ os.linesep+\
"3.1 fix that" + os.linesep+\
"3.1 test"
commit_message3=commit_message3.replace('\r\n','\n').replace('\n','\r\n')
with open("demofile.txt", "w+t") as tmpFile:
tmpFile.write("testvalue3")
os.system("git add .")
@@ -1299,6 +1303,7 @@ class Test_gitversionhelper(unittest.TestCase):
commit_message4="4.1 update this" + os.linesep+\
"4.1 fix that" + os.linesep+\
"4.1 test"
commit_message4=commit_message4.replace('\r\n','\n').replace('\n','\r\n')
with open("demofile.txt", "w+t") as tmpFile:
tmpFile.write("testvalue4")
os.system("git add .")