"Fossies" - the Fresh Open Source Software Archive

Member "http-prompt-2.1.0/tests/test_installation.py" (5 Mar 2021, 747 Bytes) of package /linux/www/http-prompt-2.1.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 """Test if http-prompt is installed correctly."""
    2 
    3 import subprocess
    4 
    5 import pytest
    6 
    7 from subprocess import PIPE
    8 
    9 from .utils import get_http_prompt_path
   10 from http_prompt import __version__
   11 
   12 
   13 def run_http_prompt(args):
   14     """Run http-prompt from terminal."""
   15     bin_path = get_http_prompt_path()
   16     p = subprocess.Popen([bin_path] + args, stdin=PIPE, stdout=PIPE)
   17     return p.communicate()
   18 
   19 
   20 @pytest.mark.slow
   21 def test_help():
   22     out, err = run_http_prompt(['--help'])
   23     assert out.startswith(b'Usage: http-prompt')
   24 
   25 
   26 @pytest.mark.slow
   27 def test_version():
   28     out, err = run_http_prompt(['--version'])
   29     version = __version__
   30     if hasattr(version, 'encode'):
   31         version = version.encode('ascii')
   32     assert out.rstrip() == version