#5360 fix: cannot import name 'escape' from 'jinja2'
Merged a year ago by ngompa. Opened a year ago by wombelix.

file modified
+5 -1
@@ -25,7 +25,11 @@ 

  import flask

  import pygit2

  import six

- from jinja2 import escape

+ 

+ try:

+     from jinja2 import escape

+ except ImportError:

+     from markupsafe import escape

  from six.moves.urllib.parse import parse_qsl, urlparse

  

  import pagure.exceptions

rebased onto 957baf7a318755bcaf585bf20c6f49f40fbe7dbf

a year ago

Lots of tests broke here...

20:35:54  =========================== short test summary info ============================
20:35:54  FAILED tests/test_pagure_flask_api_pr_flag.py::PagureFlaskApiPRFlagtests::test_no_input - json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
20:35:54  FAILED tests/test_pagure_flask_api_pr_flag.py::PagureFlaskApiPRFlagtests::test_raise_exception - AttributeError: 'NoneType' object has no attribute 'strip'
20:35:54  FAILED tests/test_pagure_flask_api_pr_flag.py::PagureFlaskApiPRFlagtests::test_updating_flag - AttributeError: 'NoneType' object has no attribute 'strip'
20:35:54  FAILED tests/test_pagure_flask_api_pr_flag.py::PagureFlaskApiPRFlagUserTokentests::test_editing_flag - AttributeError: 'NoneType' object has no attribute 'strip'
20:35:54  FAILED tests/test_pagure_flask_api_pr_flag.py::PagureFlaskApiPRFlagUserTokentests::test_invalid_status - AssertionError: {'err[58 chars]: 'EINVALIDREQ', 'errors': {'status': ['Not ...
20:35:54  FAILED tests/test_pagure_flask_api_pr_flag.py::PagureFlaskApiPRFlagUserTokentests::test_no_input - json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
20:35:54  FAILED tests/test_pagure_flask_api_fork.py::PagureFlaskApiForktests::test_api_pull_request_merge - AssertionError: 400 != 200
20:35:54  FAILED tests/test_pagure_flask_api_fork.py::PagureFlaskApiForktests::test_api_pull_request_merge_conflicting - AssertionError: 400 != 409
20:35:54  FAILED tests/test_pagure_flask_api_boards.py::PagureFlaskApiBoardstests::test_api_board_create_no_contenttype - json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
20:35:54  FAILED tests/test_pagure_flask_api_boards.py::PagureFlaskApiBoardstests::test_api_board_create_no_data - json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
20:35:54  FAILED tests/test_pagure_flask_api_issue.py::PagureFlaskApiIssuetests::test_api_update_custom_field - AssertionError: 400 != 200
20:35:54  FAILED tests/test_pagure_flask_api_fork.py::PagureFlaskApiForktests::test_api_pull_request_merge_user_token - AssertionError: 400 != 200
20:35:54  FAILED tests/test_pagure_flask_api_issue_custom_fields.py::PagureFlaskApiCustomFieldIssuetests::test_api_update_custom_field_bad_request - json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
20:35:54  FAILED tests/test_pagure_flask_api_boards.py::PagureFlaskApiBoardsWithBoardtests::test_api_board_delete_invalid_html_input - json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
20:35:54  FAILED tests/test_pagure_flask_api_plugins_install.py::PagureFlaskApiPluginInstalltests::test_install_plugin_own_project - AssertionError: 400 != 200
20:35:54  FAILED tests/test_pagure_flask_api_plugins_install.py::PagureFlaskApiPluginInstalltests::test_install_plugin_own_project_no_data - AssertionError: {'csrf_token': ['The CSRF token is missing.[38 chars]d.']} ...
20:35:54  FAILED tests/test_pagure_flask_api_project.py::PagureFlaskApiProjecttests::test_api_modify_project_invalid_request - json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
20:35:54  FAILED tests/test_pagure_flask_api_plugins_install.py::PagureFlaskApiPluginInstalltests::test_install_plugin_project_specific_token - AssertionError: 400 != 200
20:35:54  FAILED tests/test_pagure_flask_api_plugins_install.py::PagureFlaskApiPluginInstalltests::test_install_plugin_someone_else_project_project_less_token - AssertionError: 400 != 200
20:35:54  FAILED tests/test_pagure_flask_api_project.py::PagureFlaskApiProjectFlagtests::test_flag_commit_invalid_status - AssertionError: {'error': 'Invalid or incomplete input submitted[73 chars]....
20:35:54  FAILED tests/test_pagure_flask_api_pr_flag.py::PagureFlaskApiPRFlagtests::test_adding_two_flags - AttributeError: 'NoneType' object has no attribute 'strip'
20:35:54  FAILED tests/test_pagure_flask_api_project.py::PagureFlaskApiProjectFlagtests::test_flag_commit_with_custom_flags - AssertionError: {'error': 'Invalid or incomplete input submitted[73 chars]....
20:35:54  FAILED tests/test_pagure_flask_api_pr_flag.py::PagureFlaskApiPRFlagtests::test_flagging_a_pul_request_with_notification - AttributeError: 'NoneType' object has no attribute 'strip'
20:35:54  FAILED tests/test_pagure_flask_api_pr_flag.py::PagureFlaskApiPRFlagtests::test_flagging_a_pull_request_while_having_custom_statuses - AttributeError: 'NoneType' object has no attribute 'strip'
20:35:54  FAILED tests/test_pagure_flask_api_project.py::PagureFlaskApiProjectCreateProjectTests::test_api_new_project_user_token - AssertionError: {'err[61 chars]EINVALIDREQ', 'errors': {'namespace': ['Not ...
20:35:54  FAILED tests/test_pagure_flask_api_issue_change_status.py::PagureFlaskApiIssueChangeStatustests::test_api_change_status_issue_incomplete - AssertionError: {'err[58 chars]: 'EINVALIDREQ', 'errors': {'status': ['Not ...
20:35:54  FAILED tests/test_pagure_flask_api_project.py::PagureFlaskApiProjectModifyAclTests::test_api_modify_acls_invalid_acl - AssertionError: {'err[55 chars]de': 'EINVALIDREQ', 'errors': {'acl': ['Not ...
20:35:54  FAILED tests/test_pagure_flask_docs.py::PagureFlaskDocstests::test_view_docs_encoding_error - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_rebase.py::PagureRebasetests::test_rebase_api_ui_logged_in_pull_request_author - AssertionError: 400 != 200
20:35:54  FAILED tests/test_pagure_flask_dump_load_ticket.py::PagureFlaskDumpLoadTicketTests::test_dumping_reloading_ticket - ValueError: could not convert string to float: '<bound method Arrow.timesta...
20:35:54  FAILED tests/test_pagure_flask_ui_app.py::PagureFlaskAppNewProjecttests::test_new_project_with_default_branch - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_rebase.py::PagureRebaseNoHooktests::test_rebase_api_ui_logged_in - AssertionError: 400 != 200
20:35:54  FAILED tests/test_pagure_flask_ui_app.py::PagureFlaskAppNewProjecttests::test_new_project_with_default_branch_instance_wide - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_api_project.py::PagureFlaskApiProjectOptionsTests::test_api_modify_project_options_no_data - AssertionError: 400 != 200
20:35:54  FAILED tests/test_pagure_flask_rebase.py::PagureRebaseNotAllowedtests::test_rebase_api_api_logged_in - AssertionError: 400 != 200
20:35:54  FAILED tests/test_pagure_flask_ui_app.py::PagureFlaskAppNewProjecttests::test_new_project_with_default_branch_instance_wide_overriden - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_rebase.py::PagureRebaseNotAllowedtests::test_rebase_api_ui_logged_in - AssertionError: 400 != 200
20:35:54  FAILED tests/test_pagure_flask_rebase.py::PagureRebaseNotAllowedtests::test_rebase_api_ui_logged_in_different_user - AssertionError: 400 != 200
20:35:54  FAILED tests/test_pagure_flask_rebase.py::PagureRebaseNotAllowedtests::test_rebase_api_ui_logged_in_pull_request_author - AssertionError: 400 != 200
20:35:54  FAILED tests/test_pagure_flask_api_project_git_tags.py::PagureFlaskApiProjectGitTagstests::test_api_new_git_tag - TypeError: argument 5 must be str, not None
20:35:54  FAILED tests/test_pagure_flask_api_ui_private_repo.py::PagurePrivateRepotest::test_api_private_repo_change_status_issue - AssertionError: {'err[58 chars]: 'EINVALIDREQ', 'errors': {'status': ['Not ...
20:35:54  FAILED tests/test_pagure_flask_api_project_git_tags.py::PagureFlaskApiProjectGitTagstests::test_api_new_git_tag_with_commits - TypeError: argument 5 must be str, not None
20:35:54  FAILED tests/test_pagure_flask_ui_app.py::PagureFlaskApptests::test_markdown_preview_valid_commit - AssertionError: '<div class="markdown"><p>Cf commit <a hre[126 chars]div>' ...
20:35:54  FAILED tests/test_pagure_flask_ui_app.py::PagureFlaskApptests::test_new_project_with_template - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_api_issue.py::PagureFlaskApiIssuetests::test_api_change_milestone_issue_invalid_milestone - AssertionError: {'err[61 chars]EINVALIDREQ', 'errors': {'milestone': ['Not ...
20:35:54  FAILED tests/test_pagure_flask_ui_app.py::PagureFlaskApptests::test_non_ascii_new_project - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_app.py::PagureFlaskApptests::test_patched_markdown_preview - AssertionError: '<div class="markdown"><p>pingou committed[174 chars]div>' ...
20:35:54  FAILED tests/test_pagure_flask_api_ui_private_repo.py::PagurePrivateRepotest::test_api_private_repo_pr_merge - AssertionError: 400 != 200
20:35:54  FAILED tests/test_pagure_flask_api_issue.py::PagureFlaskApiIssuetests::test_api_new_issue_invalid_milestone - AssertionError: {'err[61 chars]EINVALIDREQ', 'errors': {'milestone': ['Not ...
20:35:54  FAILED tests/test_pagure_flask_rebase.py::PagureRebasetests::test_rebase_api_api_logged_in - AssertionError: 400 != 200
20:35:54  FAILED tests/test_pagure_flask_rebase.py::PagureRebasetests::test_rebase_api_conflicts - json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
20:35:54  FAILED tests/test_pagure_flask_ui_fork.py::PagureFlaskForktests::test_fork_edit_file - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_fork.py::PagureFlaskForktests::test_fork_edit_file_namespace - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_rebase.py::PagureRebasetests::test_rebase_api_ui_logged_in_different_user - AssertionError: 400 != 200
20:35:54  FAILED tests/test_pagure_flask_api_user.py::PagureFlaskApiUSertests::test_api_view_user_activity_date - AssertionError: {'err[200 chars] YYYY-MM, YYYY/MM, YYYY.MM, YYYY, W.", 'err...
20:35:54  FAILED tests/test_pagure_flask_ui_issues.py::PagureFlaskIssuestests::test_update_issue - AssertionError: '<span class="font-size-09 autogenerated-comment pl-4"><div...
20:35:54  FAILED tests/test_pagure_flask_ui_app.py::PagureFlaskAppNewProjecttests::test_new_project_readme - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_issues_templates.py::PagureFlaskIssuesTemplatetests::test_get_ticket_template_w_template - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_issues_templates.py::PagureFlaskIssuesTemplatetests::test_get_ticket_template_w_template_namespace - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_issues_templates.py::PagureFlaskIssuesTemplatetests::test_new_issue_w_specific_template - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_issues_templates.py::PagureFlaskIssuesTemplatetests::test_new_issue_w_template - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_plugins_irc.py::PagureFlaskPluginIRCtests::test_plugin_mail - TypeError: not all arguments converted during string formatting
20:35:54  FAILED tests/test_pagure_flask_ui_plugins_mail.py::PagureFlaskPluginMailtests::test_plugin_mail - TypeError: not all arguments converted during string formatting
20:35:54  FAILED tests/test_pagure_flask_ui_issues.py::PagureFlaskIssuestests::test_update_issue_add_tags - AssertionError: '<br>\n- Issue tagged with: green, red</p>' not found in '\...
20:35:54  FAILED tests/test_pagure_flask_ui_plugins_noff.py::PagureFlaskPluginNoFFtests::test_plugin_noff - TypeError: not all arguments converted during string formatting
20:35:54  FAILED tests/test_pagure_flask_ui_plugins_pagure_ci.py::PagureFlaskPluginPagureCItests::test_plugin_pagure_ci - AssertionError: '<div class="col-sm-10">\n        <input class="form-contro...
20:35:54  FAILED tests/test_pagure_flask_ui_login.py::PagureFlaskLogintests::test_force_logout - werkzeug.exceptions.BadRequestKeyError: 400 Bad Request: The browser (or pr...
20:35:54  FAILED tests/test_pagure_flask_ui_remote_pr.py::PagureRemotePRtests::test_new_remote_pr_auth - AttributeError: 'NoneType' object has no attribute 'strip'
20:35:54  FAILED tests/test_pagure_flask_ui_remote_pr.py::PagureRemotePRtests::test_new_remote_pr_ci_off - AttributeError: 'NoneType' object has no attribute 'strip'
20:35:54  FAILED tests/test_pagure_flask_ui_remote_pr.py::PagureRemotePRtests::test_new_remote_pr_ci_on - AttributeError: 'NoneType' object has no attribute 'strip'
20:35:54  FAILED tests/test_pagure_flask_ui_remote_pr.py::PagureRemotePRtests::test_new_remote_pr_empty_target - AttributeError: 'NoneType' object has no attribute 'strip'
20:35:54  FAILED tests/test_pagure_flask_ui_remote_pr.py::PagureRemotePRtests::test_new_remote_pr_unauth - AssertionError: 'You should be redirected automatically to target URL: <a h...
20:35:54  FAILED tests/test_pagure_flask_ui_plugins_rtd_hook.py::PagureFlaskPluginRtdHooktests::test_plugin_pagure_request - TypeError: not all arguments converted during string formatting
20:35:54  FAILED tests/test_pagure_flask_ui_no_master_branch.py::PagureFlaskNoMasterBranchtests::test_view_file - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_no_master_branch.py::PagureFlaskNoMasterBranchtests::test_view_raw_file - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_docs.py::PagureFlaskDocstests::test_view_docs - AssertionError: 500 != 200
20:35:54  FAILED tests/test_pagure_flask_ui_repo.py::PagureFlaskRepotests::test_view_file - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_repo.py::PagureFlaskRepotests::test_edit_file - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_repo.py::PagureFlaskRepotests::test_view_file_with_wrong_encoding - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_repo.py::PagureFlaskRepotests::test_view_raw_file - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_repo.py::PagureFlaskRepotests::test_view_repo - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_repo_view_blame.py::PagureFlaskRepoViewBlameFiletests::test_view_blame_file_default_branch_master - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_repo_view_blame.py::PagureFlaskRepoViewBlameFiletests::test_view_blame_file_default_branch_non_master - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_repo_view_blame.py::PagureFlaskRepoViewBlameFiletests::test_view_blame_file_non_ascii_name - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_fork.py::PagureFlaskForktests::test_new_request_pull_fork_to_other_unrelated_fork - AssertionError: "<p>fork/foo/test is not part of fork/ralph/test2's family<...
20:35:54  FAILED tests/test_pagure_flask_ui_repo.py::PagureFlaskRepotests::test_view_tree - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_repo_view_blame.py::PagureFlaskRepoViewBlameFiletests::test_view_blame_file_on_branch - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_repo_view_blame.py::PagureFlaskRepoViewBlameFiletests::test_view_blame_file_on_commit - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_repo_view_blame.py::PagureFlaskRepoViewBlameFiletests::test_view_blame_file_on_tag - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_fork.py::PagureFlaskForktests::test_new_request_pull_from_fork_fixing_ticket - AssertionError: '<p>Test Initial Comment</p>\n<p>Fixes <a href' not found i...
20:35:54  FAILED tests/test_pagure_flask_ui_repo_view_file.py::PagureFlaskRepoViewFiletests::test_view_file_basic_text - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_repo_view_file.py::PagureFlaskRepoViewFiletests::test_view_file_empty_file - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_repo.py::PagureFlaskRepotests::test_delete_repo - AssertionError: '<span>\n              <i class="fa fa-calendar-o fa-rotate...
20:35:54  FAILED tests/test_pagure_flask_ui_issues.py::PagureFlaskIssuestests::test_view_issue_forked_namespace_comment - AssertionError: '<span class="comment_text comment_body"><div class="markdo...
20:35:54  FAILED tests/test_pagure_flask_ui_repo_view_file.py::PagureFlaskRepoViewFiletests::test_view_file_fork_and_edit_logged_in - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_repo_view_file.py::PagureFlaskRepoViewFiletests::test_view_file_fork_and_edit_logged_out - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_issues.py::PagureFlaskIssuestests::test_view_issue_namespace_comment - AssertionError: '<span class="comment_text comment_body"><div class="markdo...
20:35:54  FAILED tests/test_pagure_flask_ui_repo.py::PagureFlaskRepotests::test_delete_repo_when_turned_off - AssertionError: '<span class="btn btn-outline-secondary disabled opacity-10...
20:35:54  FAILED tests/test_pagure_flask_ui_repo_view_file.py::PagureFlaskRepoViewFiletests::test_view_file_nested_file - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_repo_view_file.py::PagureFlaskRepoViewFiletests::test_view_file_non_ascii_file - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_repo_view_file.py::PagureFlaskRepoViewFileForktests::test_view_file_fork_and_edit_on_a_fork - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_repo_view_file.py::PagureFlaskRepoViewFileForktests::test_view_file_fork_and_edit_on_fork_logged_out - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_repo_view_file.py::PagureFlaskRepoViewFileForktests::test_view_file_fork_and_edit_on_project - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_repo_view_file.py::PagureFlaskRepoViewFileForktests::test_view_file_fork_and_edit_on_your_fork - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_repo_view_file.py::PagureFlaskRepoViewFileForktests::test_view_file_in_branch_in_fork - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_repo_view_file.py::PagureFlaskRepoViewFileForktests::test_view_file_nested_file_in_fork - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_repo.py::PagureFlaskRepotests::test_renew_api_token - AttributeError: 'NoneType' object has no attribute 'strip'
20:35:54  FAILED tests/test_pagure_flask_ui_repo.py::PagureFlaskRepotests::test_revoke_api_token - AttributeError: 'NoneType' object has no attribute 'strip'
20:35:54  FAILED tests/test_pagure_flask_ui_slash_branch_name.py::PagureFlaskSlashInBranchtests::test_view_file - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_flask_ui_slash_branch_name.py::PagureFlaskSlashInBranchtests::test_view_raw_file - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_lib.py::PagureLibtests::test_text2markdown_table - AssertionError: '<div[40 chars]\n<th>Left-aligned</th>\n<th>Center-aligned<...
20:35:54  FAILED tests/test_pagure_lib.py::PagureLibtests::test_text2markdown_table_old_mk - AssertionError: '<div[40 chars]\n<th>Left-aligned</th>\n<th>Center-aligned<...
20:35:54  FAILED tests/test_pagure_flask_ui_issues.py::PagureFlaskIssuestests::test_new_issue_customized - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_lib.py::PagureLibtests::test_text2markdown - AssertionError: 'foo bar test#1 see?' != '<div class="markdown"><p>foo bar ...
20:35:54  FAILED tests/test_pagure_lib_encoding_utils.py::TestGuessEncoding::test_guess_encoding_ascii - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_lib_encoding_utils.py::TestGuessEncoding::test_guess_encoding_favor_utf_8 - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_lib_encoding_utils.py::TestGuessEncodings::test_guess_encodings - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_lib_encoding_utils.py::TestDecode::test_decode - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_lib_git_auth.py::PagureLibGitAuthtests::test_edit_with_all_denied - AssertionError: 'Remote hook declined the push: Denied push for ref &#39;re...
20:35:54  FAILED tests/test_pagure_lib_git_auth.py::PagureLibGitAuthPagureBackendtests::test_edit_ticket_rejected - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_lib_git.py::PagureLibGitCommitToPatchtests::test_commit_to_patch_empty_commit - AssertionError: 'From 6a34ffec2d23529f8852a63ef8c6c874dfec[137 chars]\n\n' ...
20:35:54  FAILED tests/test_pagure_lib_git_auth.py::PagureLibGitAuthtests::test_edit_pr - AssertionError: 'Remote hook declined the push: Denied push for ref &#39;re...
20:35:54  FAILED tests/test_pagure_lib_git_auth.py::PagureLibGitAuthPagureBackendtests::test_edit_commit_passed_epel8 - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_lib_mimetype.py::TestMIMEType::test_get_normal_headers - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_lib_mimetype.py::TestMIMEType::test_guess_type - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_lib_git_auth.py::PagureLibGitAuthtests::test_edit_with_all_allowed - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_lib_git_auth.py::PagureLibGitAuthPagureBackendtests::test_edit_contributor_passed_epel - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_lib_git_auth.py::PagureLibGitAuthPagureBackendtests::test_edit_contributor_passed_epel8 - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_lib_git_auth.py::PagureLibGitAuthPagureBackendtests::test_edit_contributor_passed_epel_no_regex - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_lib_git_auth.py::PagureLibGitAuthPagureBackendtests::test_edit_contributor_rejected - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pagure_lib_git_auth.py::PagureLibGitAuthPagureBackendtests::test_edit_no_commit - AttributeError: 'UniversalDetector' object has no attribute '_mCharSetProbers'
20:35:54  FAILED tests/test_pfmarkdown.py::TestObjAnchorTag::test_obj_anchor_tag_pr - AttributeError: module 'markdown.util' has no attribute 'etree'
20:35:54  FAILED tests/test_pfmarkdown.py::TestObjAnchorTag::test_obj_anchor_tag_private_issue - AttributeError: module 'markdown.util' has no attribute 'etree'
20:35:54  FAILED tests/test_pagure_merge_pr_no_fork.py::PagureMergePrNoForkTest::test_api_pull_request_merge_no_fork - AssertionError: 400 != 200
20:35:54  FAILED tests/test_pfmarkdown.py::TestObjAnchorTag::test_obj_anchor_tag_issue - AttributeError: module 'markdown.util' has no attribute 'etree'
20:35:54  FAILED tests/test_pagure_merge_pr_no_fork.py::PagureMergePrNoForkTest::test_api_pull_request_merge - AssertionError: 400 != 200
20:35:54  FAILED tests/test_style.py::TestStyle::test_code_with_black - AssertionError: 1 != 0
20:35:54  ERROR tests/test_pagure_flask_ui_oidc_login.py
20:35:54  = 137 failed, 1563 passed, 7 skipped, 1165 warnings, 1 error in 958.27s (0:15:58) =

rebased onto b4f82f07b11f3ec9c96c60dad1b2c7aa1115e2d1

a year ago

I run into a lot of weird issues with the unit tests right now, even with other changes that I made on top of master. Also when looking through all of the errors above, I don't see how they can be caused by the change in this PR. I rebased and pushed again, want to see what's the outcome of a new CI run is.

rebased onto 5990e073cf1605cef61d83dae6fd2f08a5f75792

a year ago

The failing tests are not related to the actual change in this PR, activities to get the tests running again are ongoing in https://pagure.io/pagure/pull-request/5365.

I changed this PR it a little to make it more backwards compatible, as long jinja2 provides escape we going to use it - same behavior as today, if that fails we use use escape from markupsafe instead.

Without this change, tests with tox failing for all python version newer 3.6 and on rpm based systems it seem to be a 50:50 based on exact OS and version if the tests and pagure in general is still working or not.

So please let's just merge it to get not blocked, I can't think of and don't see any compatibility issues at this moment, even jinja recommends it as drop-in replacement.

This means we need markupsafe as a dependency in requirements.txt, right?

This means we need markupsafe as a dependency in requirements.txt, right?

And we need to add python%{python3_pkgversion}-markupsafe as a dependency in the spec file too.

And we need to add python%{python3_pkgversion}-markupsafe as a dependency in the spec file too.

This means we need markupsafe as a dependency in requirements.txt, right?

It will be implicitly installed because jinja2 depends on markupsafe, but I can add it explicit to the requirements.txt if you want

F36

[root@29dc77f2e9ad /]# dnf deplist python3-jinja2
Last metadata expiration check: 0:01:04 ago on Mon Jan 16 12:37:29 2023.
package: python3-jinja2-3.0.3-2.fc36.noarch
  dependency: python(abi) = 3.10
   provider: python3-3.10.9-1.fc36.i686
   provider: python3-3.10.9-1.fc36.x86_64
  dependency: python3.10dist(markupsafe) >= 2
   provider: python3-markupsafe-2.1.1-1.fc36.x86_64

pip

(venv) [root@2ee4e60e911f tox]# pip install jinja2
Collecting jinja2
  Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB)
Collecting MarkupSafe>=2.0
  Downloading MarkupSafe-2.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB)
Installing collected packages: MarkupSafe, jinja2
Successfully installed MarkupSafe-2.1.1 jinja2-3.1.2

As we're explicitly using it, I'd be more comfortable with directly expressing a dependency. I don't want any nasty surprises down the road. :sweat_smile:

As we're explicitly using it, I'd be more comfortable with directly expressing a dependency. I don't want any nasty surprises down the road. :sweat_smile:

I understand the idea but when checking requirements.txt and files/pagure.spec, both only list flask which then implicitly install jinja2 and markupsafe. Only requirements-fedora.txt contains python3-jinja2.

(pagure_env) wombelix@geeko:~/dev/forks/pagure.io/wombelix/pagure> grep -r jinja2 ./files/
./files/doc_pagure.wsgi:# two possible version of python-sqlalchemy and python-jinja2
./files/doc_pagure.wsgi:__main__.__requires__ = ['SQLAlchemy >= 0.8', 'jinja2 >= 2.4']
./files/pagure.wsgi:# two possible version of python-sqlalchemy and python-jinja2
./files/pagure.wsgi:__main__.__requires__ = ['SQLAlchemy >= 0.8', 'jinja2 >= 2.4']
./files/pagure.spec:- Backport the equalto test to ensure it works on old jinja2 version (fixes

(pagure_env) wombelix@geeko:~/dev/forks/pagure.io/wombelix/pagure> grep jinja2 ./requirements*
./requirements-fedora.txt:python3-jinja2

So I guess I just update the fedora requirements file then?

Meh. Don't bother. I'll merge it as-is.

Well, actually, after you fix the style failure, I'll merge it:

07:43:32  tests/test_style.py:120: AssertionError
07:43:32  ----------------------------- Captured stdout call -----------------------------
07:43:32  stdout: 
07:43:32  --- /pagure/pagure/ui/filters.py  2023-01-16 12:27:03.062113 +0000
07:43:32  +++ /pagure/pagure/ui/filters.py  2023-01-16 12:43:15.534177 +0000
07:43:32  @@ -23,10 +23,11 @@
07:43:32   import arrow
07:43:32   import bleach
07:43:32   import flask
07:43:32   import pygit2
07:43:32   import six
07:43:32  +
07:43:32   try:
07:43:32       from jinja2 import escape
07:43:32   except ImportError:
07:43:32       from markupsafe import escape
07:43:32   from six.moves.urllib.parse import parse_qsl, urlparse
07:43:32  
07:43:32  stderr: 
07:43:32  would reformat /pagure/pagure/ui/filters.py
07:43:32  Oh no! 💥 💔 💥
07:43:32  1 file would be reformatted, 203 files would be left unchanged.

rebased onto 56e7655

a year ago

I don't know what's up with the failing tests here, but it makes me a bit nervous to merge this until after we get the other test fixes worked out.

This improves the situation with jinja 3.x, so let's merge it.

Pull-Request has been merged by ngompa

a year ago
Metadata