Skip to content

Commit beb920d

Browse files
add a test for the new --version CLI
1 parent 9f5b7c2 commit beb920d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/test_driver.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import errno
1313
import codecs
1414
import random
15+
import unittest
1516
from tempfile import NamedTemporaryFile as ntf
1617
from argparse import Namespace
1718

@@ -20,6 +21,7 @@
2021
from tldp.inventory import stypes, status_types
2122
from tldp.sources import SourceDocument
2223
from tldp.outputs import OutputDirectory
24+
from tldp import VERSION
2325

2426
# -- Test Data
2527
import example
@@ -127,6 +129,22 @@ def test_run_statustypes(self):
127129
self.assertEqual(exitcode, os.EX_OK)
128130

129131

132+
class TestDriverShowVersion(unittest.TestCase):
133+
134+
def test_show_version(self):
135+
stdout = io.StringIO()
136+
result = tldp.driver.show_version(Namespace(), file=stdout)
137+
self.assertEqual(result, os.EX_OK)
138+
stdout.seek(0)
139+
data = stdout.read().strip()
140+
for status in status_types:
141+
self.assertEqual(VERSION, data)
142+
143+
def test_run_statustypes(self):
144+
exitcode = tldp.driver.run(['--version'])
145+
self.assertEqual(exitcode, os.EX_OK)
146+
147+
130148
class TestDriverSummary(TestInventoryBase):
131149

132150
def test_run_summary(self):

0 commit comments

Comments
 (0)