forked from sebix/python-textile
-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathtest_cli.py
More file actions
32 lines (27 loc) · 983 Bytes
/
test_cli.py
File metadata and controls
32 lines (27 loc) · 983 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import subprocess
import sys
import textile
def test_console_script():
command = [sys.executable, '-m', 'textile', 'README.textile']
try:
result = subprocess.check_output(command)
except AttributeError:
command[2] = 'textile.__main__'
result = subprocess.Popen(
command, stdout=subprocess.PIPE).communicate()[0]
with open('tests/fixtures/README.txt') as f:
expect = ''.join(f.readlines())
if isinstance(result, bytes):
result = result.decode('utf-8')
assert result == expect
def test_version_string():
command = [sys.executable, '-m', 'textile', '-v']
try:
result = subprocess.check_output(command)
except AttributeError:
command[2] = 'textile.__main__'
result = subprocess.Popen(
command, stdout=subprocess.PIPE).communicate()[0]
if isinstance(result, bytes):
result = result.decode('utf-8')
assert result.strip() == textile.__version__