File: test_cli.py

package info (click to toggle)
python-textile 1%3A4.0.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 452 kB
  • sloc: python: 2,620; sh: 7; makefile: 4
file content (30 lines) | stat: -rw-r--r-- 979 bytes parent folder | download | duplicates (2)
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__