11import unittest
22import subprocess
3- import os
43
54
65class TestCommentSpellCheck (unittest .TestCase ):
@@ -12,10 +11,8 @@ def setUpClass(self):
1211 def tearDownClass (cls ):
1312 print ("\n Tearing down comment_spell_check tests" )
1413
15- def test_comment_spell_check (self ):
16- print ("\n Command_spell_check simple test" )
17- cwd = os .getcwd ()
18- print (cwd )
14+ def test_basic (self ):
15+ print ("\n Command_spell_check: Basic Test" )
1916 runresult = subprocess .run (
2017 [
2118 "python" ,
@@ -26,15 +23,16 @@ def test_comment_spell_check(self):
2623 "--prefix" ,
2724 "myprefix" ,
2825 "tests/example.h" ,
29- ]
26+ ],
27+ stdout = subprocess .PIPE ,
3028 )
31- print ("Return code:" , runresult .returncode )
3229 if runresult .returncode :
33- self .fail ("Simple test: comment_spell_check.py process returned bad code" )
30+ self .fail ("\n Basic Test: FAIL" )
31+ output_string = str (runresult .stdout )
32+ print ("\n Test output:" , output_string )
3433
35- print ("\n Comment_spell_check test on itself" )
36- cwd = os .getcwd ()
37- print (cwd )
34+ def test_codebase (self ):
35+ print ("\n Comment_spell_check: Code Base Test" )
3836 runresult = subprocess .run (
3937 [
4038 "python" ,
@@ -47,10 +45,26 @@ def test_comment_spell_check(self):
4745 "--suffix" ,
4846 ".md" ,
4947 "." ,
50- ]
48+ ],
49+ stdout = subprocess .PIPE ,
5150 )
52- print ("Return code:" , runresult .returncode )
5351 if runresult .returncode :
54- self .fail (
55- "Self code test: comment_spell_check.py process returned bad code"
56- )
52+ self .fail ("\n Code Base Test: FAIL" )
53+ output_string = str (runresult .stdout )
54+ print ("\n Test output:" , output_string )
55+
56+ def test_version (self ):
57+ print ("\n Comment_spell_check: Version Test" )
58+ runresult = subprocess .run (
59+ [
60+ "python" ,
61+ "comment_spell_check.py" ,
62+ "--version" ,
63+ ],
64+ stdout = subprocess .PIPE ,
65+ )
66+ version_string = str (runresult .stdout )
67+ if runresult .returncode :
68+ self .fail ("Version Test: FAIL" )
69+ if "unknown" in version_string :
70+ self .fail ("Version Test: version string contains 'unknown'" )
0 commit comments