def test_print_unexpected_error_message_opt_out_2(self, isatty_mock, input_mock, post_mock): with captured() as c: ExceptionHandler()(_raise_helper, AssertionError()) assert input_mock.call_count == 1 assert post_mock.call_count == 0 assert c.stdout == '' assert "conda version" in c.stderr
def test_print_unexpected_error_message_upload_1(self, post_mock): with env_var('CONDA_REPORT_ERRORS', 'true', reset_context): with captured() as c: ExceptionHandler()(_raise_helper, AssertionError()) assert post_mock.call_count == 2 assert c.stdout == '' assert "conda version" in c.stderr
def test_print_unexpected_error_message_upload_2(self, post_mock): with env_var('CONDA_JSON', 'true', conda_tests_ctxt_mgmt_def_pol): with env_var('CONDA_YES', 'yes', conda_tests_ctxt_mgmt_def_pol): with captured() as c: ExceptionHandler()(_raise_helper, AssertionError()) assert post_mock.call_count == 3 assert len(json.loads(c.stdout)['conda_info']['channels']) >= 2 assert not c.stderr
def test_print_unexpected_error_message_upload_3(self, isatty_mock, input_mock, post_mock): with captured() as c: ExceptionHandler()(_raise_helper, AssertionError()) username = getpass.getuser() assert username_not_in_post_mock(post_mock, username) assert input_mock.call_count == 1 assert post_mock.call_count == 2 assert c.stdout == '' assert "conda version" in c.stderr
def test_print_unexpected_error_message_opt_out_1(self, input_mock, post_mock): with env_var('CONDA_REPORT_ERRORS', 'false', reset_context): e = AssertionError() with captured() as c: ExceptionHandler()(_raise_helper, AssertionError()) assert input_mock.call_count == 0 assert post_mock.call_count == 0 assert c.stdout == '' print(c.stderr, file=sys.stderr) assert "conda version" in c.stderr
def test_print_unexpected_error_message_upload_1(self, post_mock): with env_var('CONDA_REPORT_ERRORS', 'true', stack_callback=conda_tests_ctxt_mgmt_def_pol): with captured() as c: ExceptionHandler()(_raise_helper, AssertionError()) username = getpass.getuser() assert username_not_in_post_mock(post_mock, username) assert post_mock.call_count == 2 assert c.stdout == '' assert "conda version" in c.stderr
def test_print_unexpected_error_message_upload_username_with_unicode( self, pwuid, post_mock): with env_var('CONDA_REPORT_ERRORS', 'true', stack_callback=conda_tests_ctxt_mgmt_def_pol): with captured() as c: ExceptionHandler()(_raise_helper, AssertionError()) error_data = json.loads(post_mock.call_args[1].get("data")) assert error_data.get("has_spaces") == False assert error_data.get("is_ascii") == False assert post_mock.call_count == 2 assert c.stdout == '' assert "conda version" in c.stderr