import pytest
import subprocess
from subprocess import PIPE


def test_pyjokes_call_exception():
    pytest.raises(
        subprocess.CalledProcessError, "subprocess.check_call('pyjokes')"
    )


def test_pyjokes_call_output():
    try:
        p = subprocess.Popen('pyjokes', stdin=PIPE, stdout=PIPE, stderr=PIPE)
    except:
        out, err = p.communicate()
        assert out == b'Did you mean pyjoke?'
        assert p.returncode == 1
        pass

@@ -94,16 +94,21 @@
 ():%0A    
+with 
 pytest.r
@@ -113,25 +113,16 @@
 .raises(
-%0A        
 subproce
@@ -146,11 +146,19 @@
 rror
-, %22
+):%0A        
 subp
@@ -189,15 +189,8 @@
 es')
-%22%0A    )
 %0A%0A%0Ad

Use with pytest.raises