Beispiel #1
0
    def test_CondaFileNotFoundError(self):
        filename = "Groot"
        exc = PathNotFoundError(filename)
        with env_var("CONDA_JSON",
                     "yes",
                     stack_callback=conda_tests_ctxt_mgmt_def_pol):
            with captured() as c:
                conda_exception_handler(_raise_helper, exc)

        json_obj = json.loads(c.stdout)
        assert not c.stderr
        assert json_obj[
            'exception_type'] == "<class 'conda.exceptions.PathNotFoundError'>"
        assert json_obj['exception_name'] == 'PathNotFoundError'
        assert json_obj['message'] == text_type(exc)
        assert json_obj['error'] == repr(exc)

        with env_var("CONDA_JSON",
                     "no",
                     stack_callback=conda_tests_ctxt_mgmt_def_pol):
            with captured() as c:
                conda_exception_handler(_raise_helper, exc)

        assert not c.stdout
        assert c.stderr.strip() == "PathNotFoundError: Groot"
Beispiel #2
0
    def test_CondaFileNotFoundError(self):
        filename = "Groot"
        exc = PathNotFoundError(filename)
        with env_var("CONDA_JSON", "yes", reset_context):
            with captured() as c, replace_log_streams():
                conda_exception_handler(_raise_helper, exc)

        json_obj = json.loads(c.stdout)
        assert not c.stderr
        assert json_obj[
            'exception_type'] == "<class 'conda.exceptions.PathNotFoundError'>"
        assert json_obj['exception_name'] == 'PathNotFoundError'
        assert json_obj['message'] == text_type(exc)
        assert json_obj['error'] == repr(exc)

        with env_var("CONDA_JSON", "no", reset_context):
            with captured() as c, replace_log_streams():
                conda_exception_handler(_raise_helper, exc)

        assert not c.stdout
        assert c.stderr.strip() == "PathNotFoundError: Groot"