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
|
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 type(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 type(result) == bytes:
result = result.decode('utf-8')
assert result.strip() == textile.__version__
|