Skip to content

Commit 20ac538

Browse files
authored
Merge pull request #51 from dave3d/FixVersion
BUG: fixed pkg name for version
2 parents 04b40ee + 922bb3c commit 20ac538

File tree

2 files changed

+31
-17
lines changed

2 files changed

+31
-17
lines changed

comment_spell_check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
__version__ = "unknown"
2020

2121
try:
22-
__version__ = version("CommentSpellCheck")
22+
__version__ = version("comment_spell_check")
2323
except PackageNotFoundError:
2424
# package is not installed
2525
pass

tests/test_comment_spell_check.py

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import unittest
22
import subprocess
3-
import os
43

54

65
class TestCommentSpellCheck(unittest.TestCase):
@@ -12,10 +11,8 @@ def setUpClass(self):
1211
def tearDownClass(cls):
1312
print("\nTearing down comment_spell_check tests")
1413

15-
def test_comment_spell_check(self):
16-
print("\nCommand_spell_check simple test")
17-
cwd = os.getcwd()
18-
print(cwd)
14+
def test_basic(self):
15+
print("\nCommand_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("\nBasic Test: FAIL")
31+
output_string = str(runresult.stdout)
32+
print("\nTest output:", output_string)
3433

35-
print("\nComment_spell_check test on itself")
36-
cwd = os.getcwd()
37-
print(cwd)
34+
def test_codebase(self):
35+
print("\nComment_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("\nCode Base Test: FAIL")
53+
output_string = str(runresult.stdout)
54+
print("\nTest output:", output_string)
55+
56+
def test_version(self):
57+
print("\nComment_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

Comments
 (0)