| 1 | { |
| 2 | "task_id": "pytest-dev__pytest-7432", |
| 3 | "setup_info": { |
| 4 | "repo_path": "/home/haifeng/projects/reverse-prompt/SWE-bench/testbed/pytest-dev__pytest/setup_pytest-dev__pytest__5.4", |
| 5 | "env_name": "setup_pytest-dev__pytest__5.4", |
| 6 | "pre_install": [], |
| 7 | "install": "python -m pip install -e .", |
| 8 | "test_cmd": "pytest -rA testing/test_skipping.py" |
| 9 | }, |
| 10 | "task_info": { |
| 11 | "instance_id": "pytest-dev__pytest-7432", |
| 12 | "base_commit": "e6e300e729dd33956e5448d8be9a0b1540b4e53a", |
| 13 | "hints_text": "Can I look into this one?\n@debugduck Sure!\nAwesome! I'll get started on it and open up a PR when I find it. I'm a bit new, so I'm still learning about the code base.", |
| 14 | "created_at": "2020-06-29T21:51:15Z", |
| 15 | "test_patch": "diff --git a/testing/test_skipping.py b/testing/test_skipping.py\n--- a/testing/test_skipping.py\n+++ b/testing/test_skipping.py\n@@ -235,6 +235,31 @@ def test_func2():\n [\"*def test_func():*\", \"*assert 0*\", \"*1 failed*1 pass*\"]\n )\n \n+ @pytest.mark.parametrize(\n+ \"test_input,expected\",\n+ [\n+ (\n+ [\"-rs\"],\n+ [\"SKIPPED [1] test_sample.py:2: unconditional skip\", \"*1 skipped*\"],\n+ ),\n+ (\n+ [\"-rs\", \"--runxfail\"],\n+ [\"SKIPPED [1] test_sample.py:2: unconditional skip\", \"*1 skipped*\"],\n+ ),\n+ ],\n+ )\n+ def test_xfail_run_with_skip_mark(self, testdir, test_input, expected):\n+ testdir.makepyfile(\n+ test_sample=\"\"\"\n+ import pytest\n+ @pytest.mark.skip\n+ def test_skip_location() -> None:\n+ assert 0\n+ \"\"\"\n+ )\n+ result = testdir.runpytest(*test_input)\n+ result.stdout.fnmatch_lines(expected)\n+\n def test_xfail_evalfalse_but_fails(self, testdir):\n item = testdir.getitem(\n \"\"\"\n", |
| 16 | "repo": "pytest-dev/pytest", |
| 17 | "problem_statement": "skipping: --runxfail breaks pytest.mark.skip location reporting\npytest versions: 5.4.x, current master\r\n\r\nWhen `@pytest.mark.skip`/`skipif` marks are used to skip a test, for example\r\n\r\n```py\r\nimport pytest\r\n@pytest.mark.skip\r\ndef test_skip_location() -> None:\r\n assert 0\r\n```\r\n\r\nthe expected skip location reported should point to the item itself, and this is indeed what happens when running with `pytest -rs`:\r\n\r\n```\r\nSKIPPED [1] test_it.py:3: unconditional skip\r\n```\r\n\r\nHowever, adding `pytest -rs --runxfail` breaks this:\r\n\r\n```\r\nSKIPPED [1] src/_pytest/skipping.py:238: unconditional skip\r\n```\r\n\r\nThe `--runxfail` is only about xfail and should not affect this at all.\r\n\r\n---\r\n\r\nHint: the bug is in `src/_pytest/skipping.py`, the `pytest_runtest_makereport` hook.\n", |
| 18 | "version": "5.4", |
| 19 | "FAIL_TO_PASS": [ |
| 20 | "testing/test_skipping.py::TestXFail::test_xfail_run_with_skip_mark[test_input1-expected1]" |
| 21 | ], |
| 22 | "PASS_TO_PASS": [ |
| 23 | "testing/test_skipping.py::TestBooleanCondition::test_skipif", |
| 24 | "testing/test_skipping.py::TestBooleanCondition::test_skipif_noreason", |
| 25 | "testing/test_skipping.py::TestBooleanCondition::test_xfail", |
| 26 | "testing/test_skipping.py::TestEvaluation::test_marked_one_arg", |
| 27 | "testing/test_skipping.py::TestEvaluation::test_marked_one_arg_twice", |
| 28 | "testing/test_skipping.py::TestEvaluation::test_marked_one_arg_twice2", |
| 29 | "testing/test_skipping.py::TestEvaluation::test_marked_one_arg_with_reason", |
| 30 | "testing/test_skipping.py::TestEvaluation::test_marked_skipif_no_args", |
| 31 | "testing/test_skipping.py::TestEvaluation::test_marked_skipif_with_boolean_without_reason", |
| 32 | "testing/test_skipping.py::TestEvaluation::test_marked_skipif_with_invalid_boolean", |
| 33 | "testing/test_skipping.py::TestEvaluation::test_marked_xfail_no_args", |
| 34 | "testing/test_skipping.py::TestEvaluation::test_no_marker", |
| 35 | "testing/test_skipping.py::TestEvaluation::test_skipif_class", |
| 36 | "testing/test_skipping.py::TestSkip::test_arg_as_reason", |
| 37 | "testing/test_skipping.py::TestSkip::test_only_skips_marked_test", |
| 38 | "testing/test_skipping.py::TestSkip::test_skip_class", |
| 39 | "testing/test_skipping.py::TestSkip::test_skip_no_reason", |
| 40 | "testing/test_skipping.py::TestSkip::test_skip_with_reason", |
| 41 | "testing/test_skipping.py::TestSkip::test_skips_on_false_string", |
| 42 | "testing/test_skipping.py::TestSkip::test_strict_and_skip", |
| 43 | "testing/test_skipping.py::TestSkipif::test_skipif_conditional", |
| 44 | "testing/test_skipping.py::TestSkipif::test_skipif_reporting[\"hasattr(sys,", |
| 45 | "testing/test_skipping.py::TestSkipif::test_skipif_reporting[True,", |
| 46 | "testing/test_skipping.py::TestSkipif::test_skipif_reporting_multiple[skipif-SKIP-skipped]", |
| 47 | "testing/test_skipping.py::TestSkipif::test_skipif_reporting_multiple[xfail-XPASS-xpassed]", |
| 48 | "testing/test_skipping.py::TestSkipif::test_skipif_using_platform", |
| 49 | "testing/test_skipping.py::TestXFail::test_dynamic_xfail_no_run", |
| 50 | "testing/test_skipping.py::TestXFail::test_dynamic_xfail_set_during_funcarg_setup", |
| 51 | "testing/test_skipping.py::TestXFail::test_strict_sanity", |
| 52 | "testing/test_skipping.py::TestXFail::test_strict_xfail[False]", |
| 53 | "testing/test_skipping.py::TestXFail::test_strict_xfail[True]", |
| 54 | "testing/test_skipping.py::TestXFail::test_strict_xfail_condition[False]", |
| 55 | "testing/test_skipping.py::TestXFail::test_strict_xfail_condition[True]", |
| 56 | "testing/test_skipping.py::TestXFail::test_strict_xfail_default_from_file[false]", |
| 57 | "testing/test_skipping.py::TestXFail::test_strict_xfail_default_from_file[true]", |
| 58 | "testing/test_skipping.py::TestXFail::test_xfail_condition_keyword[False]", |
| 59 | "testing/test_skipping.py::TestXFail::test_xfail_condition_keyword[True]", |
| 60 | "testing/test_skipping.py::TestXFail::test_xfail_evalfalse_but_fails", |
| 61 | "testing/test_skipping.py::TestXFail::test_xfail_imperative", |
| 62 | "testing/test_skipping.py::TestXFail::test_xfail_imperative_in_setup_function", |
| 63 | "testing/test_skipping.py::TestXFail::test_xfail_not_report_default", |
| 64 | "testing/test_skipping.py::TestXFail::test_xfail_not_run_no_setup_run", |
| 65 | "testing/test_skipping.py::TestXFail::test_xfail_not_run_xfail_reporting", |
| 66 | "testing/test_skipping.py::TestXFail::test_xfail_raises[(AttributeError,", |
| 67 | "testing/test_skipping.py::TestXFail::test_xfail_raises[TypeError-IndexError-*1", |
| 68 | "testing/test_skipping.py::TestXFail::test_xfail_raises[TypeError-TypeError-*1", |
| 69 | "testing/test_skipping.py::TestXFail::test_xfail_run_anyway", |
| 70 | "testing/test_skipping.py::TestXFail::test_xfail_run_with_skip_mark[test_input0-expected0]", |
| 71 | "testing/test_skipping.py::TestXFail::test_xfail_simple[False]", |
| 72 | "testing/test_skipping.py::TestXFail::test_xfail_simple[True]", |
| 73 | "testing/test_skipping.py::TestXFail::test_xfail_using_platform", |
| 74 | "testing/test_skipping.py::TestXFail::test_xfail_xpass", |
| 75 | "testing/test_skipping.py::TestXFail::test_xfail_xpassed", |
| 76 | "testing/test_skipping.py::TestXFail::test_xfail_xpassed_strict", |
| 77 | "testing/test_skipping.py::TestXFailwithSetupTeardown::test_failing_setup_issue9", |
| 78 | "testing/test_skipping.py::TestXFailwithSetupTeardown::test_failing_teardown_issue9", |
| 79 | "testing/test_skipping.py::test_default_markers", |
| 80 | "testing/test_skipping.py::test_errors_in_xfail_skip_expressions", |
| 81 | "testing/test_skipping.py::test_imperativeskip_on_xfail_test", |
| 82 | "testing/test_skipping.py::test_importorskip", |
| 83 | "testing/test_skipping.py::test_invalid_skip_keyword_parameter", |
| 84 | "testing/test_skipping.py::test_mark_xfail_item", |
| 85 | "testing/test_skipping.py::test_module_level_skip_error", |
| 86 | "testing/test_skipping.py::test_module_level_skip_with_allow_module_level", |
| 87 | "testing/test_skipping.py::test_relpath_rootdir", |
| 88 | "testing/test_skipping.py::test_reportchars", |
| 89 | "testing/test_skipping.py::test_reportchars_all", |
| 90 | "testing/test_skipping.py::test_reportchars_all_error", |
| 91 | "testing/test_skipping.py::test_reportchars_error", |
| 92 | "testing/test_skipping.py::test_skip_not_report_default", |
| 93 | "testing/test_skipping.py::test_skipif_class", |
| 94 | "testing/test_skipping.py::test_skipped_folding", |
| 95 | "testing/test_skipping.py::test_skipped_reasons_functional", |
| 96 | "testing/test_skipping.py::test_summary_list_after_errors", |
| 97 | "testing/test_skipping.py::test_xfail_item", |
| 98 | "testing/test_skipping.py::test_xfail_skipif_with_globals", |
| 99 | "testing/test_skipping.py::test_xfail_test_setup_exception" |
| 100 | ], |
| 101 | "environment_setup_commit": "678c1a0745f1cf175c442c719906a1f13e496910", |
| 102 | "patch": "diff --git a/src/_pytest/skipping.py b/src/_pytest/skipping.py\n--- a/src/_pytest/skipping.py\n+++ b/src/_pytest/skipping.py\n@@ -291,7 +291,8 @@ def pytest_runtest_makereport(item: Item, call: CallInfo[None]):\n else:\n rep.outcome = \"passed\"\n rep.wasxfail = xfailed.reason\n- elif (\n+\n+ if (\n item._store.get(skipped_by_mark_key, True)\n and rep.skipped\n and type(rep.longrepr) is tuple\n", |
| 103 | "pr_link": "https://github.com/pytest-dev/pytest/pull/7432" |
| 104 | } |
| 105 | } |