import os

from mccabe import main as mccabe_main
from python_skeleton.python_skeleton import PythonSkeleton


def test_main() -> None:
    try:
        PythonSkeleton.main()
        assert False
    except SystemExit:
        assert True


def test_return_code(capsys) -> None:
    exit_code = PythonSkeleton(['friend']).run()
    assert exit_code == 0
    output, error = capsys.readouterr()
    assert output == 'Hello friend.\n'
    assert error == ''


def test_flake_command(capsys) -> None:
    mccabe_main([os.path.abspath(__file__)])
    output, error = capsys.readouterr()
    assert output != ''
    assert error == ''

@@ -2,16 +2,30 @@
 mport os
+%0Aimport pytest
 %0A%0Afrom m
@@ -151,11 +151,38 @@
     
-try
+with pytest.raises(SystemExit)
 :%0A  
@@ -213,72 +213,8 @@
 n()%0A
-        assert False%0A    except SystemExit:%0A        assert True%0A
 %0A%0Ade

use pytest way to test for exception