| 1 | { |
| 2 | "task_id": "pytest-dev__pytest-6116", |
| 3 | "setup_info": { |
| 4 | "repo_path": "/media/media0/yuntong/SWE-bench/testbed/pytest-dev__pytest/setup_pytest-dev__pytest__5.2", |
| 5 | "env_name": "setup_pytest-dev__pytest__5.2", |
| 6 | "pre_install": [], |
| 7 | "install": "python -m pip install -e .", |
| 8 | "test_cmd": "pytest -rA testing/test_collection.py" |
| 9 | }, |
| 10 | "task_info": { |
| 11 | "instance_id": "pytest-dev__pytest-6116", |
| 12 | "base_commit": "e670ff76cbad80108bde9bab616b66771b8653cf", |
| 13 | "hints_text": "Agreed, it's probably the option I use most which doesn't have a shortcut.\r\n\r\nBoth `-c` and `-o` are taken. I guess `-n` (as in \"no action\", compare `-n`/`--dry-run` for e.g. `git clean`) could work? \r\n\r\nMaybe `--co` (for either \"**co**llect\" or \"**c**ollect **o**nly), similar to other two-character shortcuts we already have (`--sw`, `--lf`, `--ff`, `--nf`)?\nI like `--co`, and it doesn't seem to be used by any plugins as far as I can search:\r\n\r\nhttps://github.com/search?utf8=%E2%9C%93&q=--co+language%3APython+pytest+language%3APython+language%3APython&type=Code&ref=advsearch&l=Python&l=Python\n> I find myself needing to run `--collect-only` very often and that cli argument is a very long to type one.\r\n\r\nJust out of curiosity: Why? (i.e. what's your use case?)\r\n\r\n+0 for `--co`.\r\n\r\nBut in general you can easily also have an alias \"alias pco='pytest --collect-only'\" - (or \"alias pco='p --collect-only\" if you have a shortcut for pytest already.. :))\nI routinely use `--collect-only` when I switch to a different development branch or start working on a different area of our code base. I think `--co` is fine.\nAgreed, it's probably the option I use most which doesn't have a shortcut.\r\n\r\nBoth `-c` and `-o` are taken. I guess `-n` (as in \"no action\", compare `-n`/`--dry-run` for e.g. `git clean`) could work? \r\n\r\nMaybe `--co` (for either \"**co**llect\" or \"**c**ollect **o**nly), similar to other two-character shortcuts we already have (`--sw`, `--lf`, `--ff`, `--nf`)?\nI like `--co`, and it doesn't seem to be used by any plugins as far as I can search:\r\n\r\nhttps://github.com/search?utf8=%E2%9C%93&q=--co+language%3APython+pytest+language%3APython+language%3APython&type=Code&ref=advsearch&l=Python&l=Python\n> I find myself needing to run `--collect-only` very often and that cli argument is a very long to type one.\r\n\r\nJust out of curiosity: Why? (i.e. what's your use case?)\r\n\r\n+0 for `--co`.\r\n\r\nBut in general you can easily also have an alias \"alias pco='pytest --collect-only'\" - (or \"alias pco='p --collect-only\" if you have a shortcut for pytest already.. :))\nI routinely use `--collect-only` when I switch to a different development branch or start working on a different area of our code base. I think `--co` is fine.", |
| 14 | "created_at": "2019-11-01T20:05:53Z", |
| 15 | "test_patch": "diff --git a/testing/test_collection.py b/testing/test_collection.py\n--- a/testing/test_collection.py\n+++ b/testing/test_collection.py\n@@ -402,7 +402,7 @@ def pytest_collect_file(path, parent):\n )\n testdir.mkdir(\"sub\")\n testdir.makepyfile(\"def test_x(): pass\")\n- result = testdir.runpytest(\"--collect-only\")\n+ result = testdir.runpytest(\"--co\")\n result.stdout.fnmatch_lines([\"*MyModule*\", \"*test_x*\"])\n \n def test_pytest_collect_file_from_sister_dir(self, testdir):\n@@ -433,7 +433,7 @@ def pytest_collect_file(path, parent):\n p = testdir.makepyfile(\"def test_x(): pass\")\n p.copy(sub1.join(p.basename))\n p.copy(sub2.join(p.basename))\n- result = testdir.runpytest(\"--collect-only\")\n+ result = testdir.runpytest(\"--co\")\n result.stdout.fnmatch_lines([\"*MyModule1*\", \"*MyModule2*\", \"*test_x*\"])\n \n \n", |
| 16 | "repo": "pytest-dev/pytest", |
| 17 | "problem_statement": "pytest --collect-only needs a one char shortcut command\nI find myself needing to run `--collect-only` very often and that cli argument is a very long to type one. \r\n\r\nI do think that it would be great to allocate a character for it, not sure which one yet. Please use up/down thumbs to vote if you would find it useful or not and eventually proposing which char should be used. \r\n\r\nClearly this is a change very easy to implement but first I want to see if others would find it useful or not.\npytest --collect-only needs a one char shortcut command\nI find myself needing to run `--collect-only` very often and that cli argument is a very long to type one. \r\n\r\nI do think that it would be great to allocate a character for it, not sure which one yet. Please use up/down thumbs to vote if you would find it useful or not and eventually proposing which char should be used. \r\n\r\nClearly this is a change very easy to implement but first I want to see if others would find it useful or not.\n", |
| 18 | "version": "5.2", |
| 19 | "FAIL_TO_PASS": [ |
| 20 | "testing/test_collection.py::TestCustomConftests::test_pytest_collect_file_from_sister_dir", |
| 21 | "testing/test_collection.py::TestCustomConftests::test_pytest_fs_collect_hooks_are_seen" |
| 22 | ], |
| 23 | "PASS_TO_PASS": [ |
| 24 | "testing/test_collection.py::TestCollectFS::test__in_venv[Activate.bat]", |
| 25 | "testing/test_collection.py::TestCollectFS::test__in_venv[Activate.ps1]", |
| 26 | "testing/test_collection.py::TestCollectFS::test__in_venv[Activate]", |
| 27 | "testing/test_collection.py::TestCollectFS::test__in_venv[activate.csh]", |
| 28 | "testing/test_collection.py::TestCollectFS::test__in_venv[activate.fish]", |
| 29 | "testing/test_collection.py::TestCollectFS::test__in_venv[activate]", |
| 30 | "testing/test_collection.py::TestCollectFS::test_custom_norecursedirs", |
| 31 | "testing/test_collection.py::TestCollectFS::test_ignored_certain_directories", |
| 32 | "testing/test_collection.py::TestCollectFS::test_ignored_virtualenvs[Activate.bat]", |
| 33 | "testing/test_collection.py::TestCollectFS::test_ignored_virtualenvs[Activate.ps1]", |
| 34 | "testing/test_collection.py::TestCollectFS::test_ignored_virtualenvs[Activate]", |
| 35 | "testing/test_collection.py::TestCollectFS::test_ignored_virtualenvs[activate.csh]", |
| 36 | "testing/test_collection.py::TestCollectFS::test_ignored_virtualenvs[activate.fish]", |
| 37 | "testing/test_collection.py::TestCollectFS::test_ignored_virtualenvs[activate]", |
| 38 | "testing/test_collection.py::TestCollectFS::test_ignored_virtualenvs_norecursedirs_precedence[Activate.bat]", |
| 39 | "testing/test_collection.py::TestCollectFS::test_ignored_virtualenvs_norecursedirs_precedence[Activate.ps1]", |
| 40 | "testing/test_collection.py::TestCollectFS::test_ignored_virtualenvs_norecursedirs_precedence[Activate]", |
| 41 | "testing/test_collection.py::TestCollectFS::test_ignored_virtualenvs_norecursedirs_precedence[activate.csh]", |
| 42 | "testing/test_collection.py::TestCollectFS::test_ignored_virtualenvs_norecursedirs_precedence[activate.fish]", |
| 43 | "testing/test_collection.py::TestCollectFS::test_ignored_virtualenvs_norecursedirs_precedence[activate]", |
| 44 | "testing/test_collection.py::TestCollectFS::test_testpaths_ini", |
| 45 | "testing/test_collection.py::TestCollectPluginHookRelay::test_pytest_collect_directory", |
| 46 | "testing/test_collection.py::TestCollectPluginHookRelay::test_pytest_collect_file", |
| 47 | "testing/test_collection.py::TestCollector::test_can_skip_class_with_test_attr", |
| 48 | "testing/test_collection.py::TestCollector::test_check_equality", |
| 49 | "testing/test_collection.py::TestCollector::test_collect_versus_item", |
| 50 | "testing/test_collection.py::TestCollector::test_getcustomfile_roundtrip", |
| 51 | "testing/test_collection.py::TestCollector::test_getparent", |
| 52 | "testing/test_collection.py::TestCustomConftests::test_collectignore_exclude_on_option", |
| 53 | "testing/test_collection.py::TestCustomConftests::test_collectignoreglob_exclude_on_option", |
| 54 | "testing/test_collection.py::TestCustomConftests::test_ignore_collect_not_called_on_argument", |
| 55 | "testing/test_collection.py::TestCustomConftests::test_ignore_collect_path", |
| 56 | "testing/test_collection.py::TestNodekeywords::test_issue345", |
| 57 | "testing/test_collection.py::TestNodekeywords::test_no_under", |
| 58 | "testing/test_collection.py::TestPrunetraceback::test_custom_repr_failure", |
| 59 | "testing/test_collection.py::TestSession::test_collect_custom_nodes_multi_id", |
| 60 | "testing/test_collection.py::TestSession::test_collect_protocol_method", |
| 61 | "testing/test_collection.py::TestSession::test_collect_protocol_single_function", |
| 62 | "testing/test_collection.py::TestSession::test_collect_subdir_event_ordering", |
| 63 | "testing/test_collection.py::TestSession::test_collect_topdir", |
| 64 | "testing/test_collection.py::TestSession::test_collect_two_commandline_args", |
| 65 | "testing/test_collection.py::TestSession::test_find_byid_without_instance_parents", |
| 66 | "testing/test_collection.py::TestSession::test_parsearg", |
| 67 | "testing/test_collection.py::TestSession::test_serialization_byid", |
| 68 | "testing/test_collection.py::Test_genitems::test_check_collect_hashes", |
| 69 | "testing/test_collection.py::Test_genitems::test_class_and_functions_discovery_using_glob", |
| 70 | "testing/test_collection.py::Test_genitems::test_example_items1", |
| 71 | "testing/test_collection.py::Test_getinitialnodes::test_global_file", |
| 72 | "testing/test_collection.py::Test_getinitialnodes::test_pkgfile", |
| 73 | "testing/test_collection.py::test_collect_handles_raising_on_dunder_class", |
| 74 | "testing/test_collection.py::test_collect_init_tests", |
| 75 | "testing/test_collection.py::test_collect_invalid_signature_message", |
| 76 | "testing/test_collection.py::test_collect_pkg_init_and_file_in_args", |
| 77 | "testing/test_collection.py::test_collect_pkg_init_only", |
| 78 | "testing/test_collection.py::test_collect_pyargs_with_testpaths", |
| 79 | "testing/test_collection.py::test_collect_sub_with_symlinks[False]", |
| 80 | "testing/test_collection.py::test_collect_sub_with_symlinks[True]", |
| 81 | "testing/test_collection.py::test_collect_symlink_file_arg", |
| 82 | "testing/test_collection.py::test_collect_symlink_out_of_tree", |
| 83 | "testing/test_collection.py::test_collect_with_chdir_during_import", |
| 84 | "testing/test_collection.py::test_collectignore_via_conftest", |
| 85 | "testing/test_collection.py::test_collector_respects_tbstyle", |
| 86 | "testing/test_collection.py::test_continue_on_collection_errors", |
| 87 | "testing/test_collection.py::test_continue_on_collection_errors_maxfail", |
| 88 | "testing/test_collection.py::test_exit_on_collection_error", |
| 89 | "testing/test_collection.py::test_exit_on_collection_with_maxfail_bigger_than_n_errors", |
| 90 | "testing/test_collection.py::test_exit_on_collection_with_maxfail_smaller_than_n_errors", |
| 91 | "testing/test_collection.py::test_fixture_scope_sibling_conftests", |
| 92 | "testing/test_collection.py::test_matchnodes_two_collections_same_file" |
| 93 | ], |
| 94 | "environment_setup_commit": "f36ea240fe3579f945bf5d6cc41b5e45a572249d", |
| 95 | "patch": "diff --git a/src/_pytest/main.py b/src/_pytest/main.py\n--- a/src/_pytest/main.py\n+++ b/src/_pytest/main.py\n@@ -109,6 +109,7 @@ def pytest_addoption(parser):\n group.addoption(\n \"--collectonly\",\n \"--collect-only\",\n+ \"--co\",\n action=\"store_true\",\n help=\"only collect tests, don't execute them.\",\n ),\n", |
| 96 | "pr_link": "https://github.com/pytest-dev/pytest/pull/6116" |
| 97 | } |
| 98 | } |