Elffuss BraidHub

kikocis/auto-code-rover public

main · 19.8 KiBRawPermalink
1{
2 "task_id": "pytest-dev__pytest-5221",
3 "setup_info": {
4 "repo_path": "/media/media0/yuntong/SWE-bench/testbed/pytest-dev__pytest/setup_pytest-dev__pytest__4.4",
5 "env_name": "setup_pytest-dev__pytest__4.4",
6 "pre_install": [],
7 "install": "python -m pip install -e .",
8 "test_cmd": "pytest -rA testing/python/fixtures.py"
9 },
10 "task_info": {
11 "instance_id": "pytest-dev__pytest-5221",
12 "base_commit": "4a2fdce62b73944030cff9b3e52862868ca9584d",
13 "hints_text": "",
14 "created_at": "2019-05-06T22:36:44Z",
15 "test_patch": "diff --git a/testing/python/fixtures.py b/testing/python/fixtures.py\n--- a/testing/python/fixtures.py\n+++ b/testing/python/fixtures.py\n@@ -3037,11 +3037,25 @@ def test_funcarg_compat(self, testdir):\n \n def test_show_fixtures(self, testdir):\n result = testdir.runpytest(\"--fixtures\")\n- result.stdout.fnmatch_lines([\"*tmpdir*\", \"*temporary directory*\"])\n+ result.stdout.fnmatch_lines(\n+ [\n+ \"tmpdir_factory [[]session scope[]]\",\n+ \"*for the test session*\",\n+ \"tmpdir\",\n+ \"*temporary directory*\",\n+ ]\n+ )\n \n def test_show_fixtures_verbose(self, testdir):\n result = testdir.runpytest(\"--fixtures\", \"-v\")\n- result.stdout.fnmatch_lines([\"*tmpdir*--*tmpdir.py*\", \"*temporary directory*\"])\n+ result.stdout.fnmatch_lines(\n+ [\n+ \"tmpdir_factory [[]session scope[]] -- *tmpdir.py*\",\n+ \"*for the test session*\",\n+ \"tmpdir -- *tmpdir.py*\",\n+ \"*temporary directory*\",\n+ ]\n+ )\n \n def test_show_fixtures_testmodule(self, testdir):\n p = testdir.makepyfile(\n",
16 "repo": "pytest-dev/pytest",
17 "problem_statement": "Display fixture scope with `pytest --fixtures`\nIt would be useful to show fixture scopes with `pytest --fixtures`; currently the only way to learn the scope of a fixture is look at the docs (when that is documented) or at the source code.\n",
18 "version": "4.4",
19 "FAIL_TO_PASS": [
20 "testing/python/fixtures.py::TestShowFixtures::test_show_fixtures",
21 "testing/python/fixtures.py::TestShowFixtures::test_show_fixtures_verbose"
22 ],
23 "PASS_TO_PASS": [
24 "testing/python/fixtures.py::TestAutouseDiscovery::test_autouse_in_conftests",
25 "testing/python/fixtures.py::TestAutouseDiscovery::test_autouse_in_module_and_two_classes",
26 "testing/python/fixtures.py::TestAutouseDiscovery::test_callables_nocode",
27 "testing/python/fixtures.py::TestAutouseDiscovery::test_parsefactories_conftest",
28 "testing/python/fixtures.py::TestAutouseDiscovery::test_setup_at_classlevel",
29 "testing/python/fixtures.py::TestAutouseDiscovery::test_two_classes_separated_autouse",
30 "testing/python/fixtures.py::TestAutouseManagement::test_autouse_conftest_mid_directory",
31 "testing/python/fixtures.py::TestAutouseManagement::test_class_function_parametrization_finalization",
32 "testing/python/fixtures.py::TestAutouseManagement::test_funcarg_and_setup",
33 "testing/python/fixtures.py::TestAutouseManagement::test_ordering_autouse_before_explicit",
34 "testing/python/fixtures.py::TestAutouseManagement::test_ordering_dependencies_torndown_first[p10-p00]",
35 "testing/python/fixtures.py::TestAutouseManagement::test_ordering_dependencies_torndown_first[p10-p01]",
36 "testing/python/fixtures.py::TestAutouseManagement::test_ordering_dependencies_torndown_first[p11-p00]",
37 "testing/python/fixtures.py::TestAutouseManagement::test_ordering_dependencies_torndown_first[p11-p01]",
38 "testing/python/fixtures.py::TestAutouseManagement::test_parametrization_setup_teardown_ordering",
39 "testing/python/fixtures.py::TestAutouseManagement::test_scope_ordering",
40 "testing/python/fixtures.py::TestAutouseManagement::test_session_parametrized_function",
41 "testing/python/fixtures.py::TestAutouseManagement::test_uses_parametrized_resource",
42 "testing/python/fixtures.py::TestContextManagerFixtureFuncs::test_custom_name[fixture]",
43 "testing/python/fixtures.py::TestContextManagerFixtureFuncs::test_custom_name[yield_fixture]",
44 "testing/python/fixtures.py::TestContextManagerFixtureFuncs::test_scoped[fixture]",
45 "testing/python/fixtures.py::TestContextManagerFixtureFuncs::test_scoped[yield_fixture]",
46 "testing/python/fixtures.py::TestContextManagerFixtureFuncs::test_setup_exception[fixture]",
47 "testing/python/fixtures.py::TestContextManagerFixtureFuncs::test_setup_exception[yield_fixture]",
48 "testing/python/fixtures.py::TestContextManagerFixtureFuncs::test_simple[fixture]",
49 "testing/python/fixtures.py::TestContextManagerFixtureFuncs::test_simple[yield_fixture]",
50 "testing/python/fixtures.py::TestContextManagerFixtureFuncs::test_teardown_exception[fixture]",
51 "testing/python/fixtures.py::TestContextManagerFixtureFuncs::test_teardown_exception[yield_fixture]",
52 "testing/python/fixtures.py::TestContextManagerFixtureFuncs::test_yields_more_than_one[fixture]",
53 "testing/python/fixtures.py::TestContextManagerFixtureFuncs::test_yields_more_than_one[yield_fixture]",
54 "testing/python/fixtures.py::TestErrors::test_issue498_fixture_finalizer_failing",
55 "testing/python/fixtures.py::TestErrors::test_setupfunc_missing_funcarg",
56 "testing/python/fixtures.py::TestErrors::test_subfactory_missing_funcarg",
57 "testing/python/fixtures.py::TestFillFixtures::test_autouse_fixture_plugin",
58 "testing/python/fixtures.py::TestFillFixtures::test_conftest_funcargs_only_available_in_subdir",
59 "testing/python/fixtures.py::TestFillFixtures::test_detect_recursive_dependency_error",
60 "testing/python/fixtures.py::TestFillFixtures::test_extend_fixture_conftest_conftest",
61 "testing/python/fixtures.py::TestFillFixtures::test_extend_fixture_conftest_module",
62 "testing/python/fixtures.py::TestFillFixtures::test_extend_fixture_conftest_plugin",
63 "testing/python/fixtures.py::TestFillFixtures::test_extend_fixture_module_class",
64 "testing/python/fixtures.py::TestFillFixtures::test_extend_fixture_plugin_plugin",
65 "testing/python/fixtures.py::TestFillFixtures::test_fillfuncargs_exposed",
66 "testing/python/fixtures.py::TestFillFixtures::test_fixture_excinfo_leak",
67 "testing/python/fixtures.py::TestFillFixtures::test_funcarg_basic",
68 "testing/python/fixtures.py::TestFillFixtures::test_funcarg_lookup_classlevel",
69 "testing/python/fixtures.py::TestFillFixtures::test_funcarg_lookup_error",
70 "testing/python/fixtures.py::TestFillFixtures::test_funcarg_lookup_modulelevel",
71 "testing/python/fixtures.py::TestFillFixtures::test_funcarg_lookupfails",
72 "testing/python/fixtures.py::TestFillFixtures::test_override_autouse_fixture_with_parametrized_fixture_conftest_conftest",
73 "testing/python/fixtures.py::TestFillFixtures::test_override_non_parametrized_fixture_conftest_conftest",
74 "testing/python/fixtures.py::TestFillFixtures::test_override_non_parametrized_fixture_conftest_module",
75 "testing/python/fixtures.py::TestFillFixtures::test_override_parametrized_fixture_conftest_conftest",
76 "testing/python/fixtures.py::TestFillFixtures::test_override_parametrized_fixture_conftest_module",
77 "testing/python/fixtures.py::TestFixtureManagerParseFactories::test_collect_custom_items",
78 "testing/python/fixtures.py::TestFixtureManagerParseFactories::test_package_fixture_complex",
79 "testing/python/fixtures.py::TestFixtureManagerParseFactories::test_package_xunit_fixture",
80 "testing/python/fixtures.py::TestFixtureManagerParseFactories::test_parsefactories_conftest",
81 "testing/python/fixtures.py::TestFixtureManagerParseFactories::test_parsefactories_conftest_and_module_and_class",
82 "testing/python/fixtures.py::TestFixtureManagerParseFactories::test_parsefactories_evil_objects_issue214",
83 "testing/python/fixtures.py::TestFixtureManagerParseFactories::test_parsefactories_relative_node_ids",
84 "testing/python/fixtures.py::TestFixtureMarker::test_class_ordering",
85 "testing/python/fixtures.py::TestFixtureMarker::test_class_scope_parametrization_ordering",
86 "testing/python/fixtures.py::TestFixtureMarker::test_class_scope_with_normal_tests",
87 "testing/python/fixtures.py::TestFixtureMarker::test_deterministic_fixture_collection",
88 "testing/python/fixtures.py::TestFixtureMarker::test_dynamic_parametrized_ordering",
89 "testing/python/fixtures.py::TestFixtureMarker::test_finalizer_order_on_parametrization[function]",
90 "testing/python/fixtures.py::TestFixtureMarker::test_finalizer_order_on_parametrization[module]",
91 "testing/python/fixtures.py::TestFixtureMarker::test_finalizer_order_on_parametrization[session]",
92 "testing/python/fixtures.py::TestFixtureMarker::test_fixture_finalizer",
93 "testing/python/fixtures.py::TestFixtureMarker::test_fixture_marked_function_not_collected_as_test",
94 "testing/python/fixtures.py::TestFixtureMarker::test_module_parametrized_ordering",
95 "testing/python/fixtures.py::TestFixtureMarker::test_multiple_parametrization_issue_736",
96 "testing/python/fixtures.py::TestFixtureMarker::test_override_parametrized_fixture_issue_979['fixt,",
97 "testing/python/fixtures.py::TestFixtureMarker::test_override_parametrized_fixture_issue_979['fixt,val']",
98 "testing/python/fixtures.py::TestFixtureMarker::test_override_parametrized_fixture_issue_979[('fixt',",
99 "testing/python/fixtures.py::TestFixtureMarker::test_override_parametrized_fixture_issue_979[['fixt',",
100 "testing/python/fixtures.py::TestFixtureMarker::test_parametrize",
101 "testing/python/fixtures.py::TestFixtureMarker::test_parametrize_and_scope",
102 "testing/python/fixtures.py::TestFixtureMarker::test_parametrize_function_scoped_finalizers_called",
103 "testing/python/fixtures.py::TestFixtureMarker::test_parametrize_separated_lifecycle",
104 "testing/python/fixtures.py::TestFixtureMarker::test_parametrize_separated_order",
105 "testing/python/fixtures.py::TestFixtureMarker::test_parametrize_separated_order_higher_scope_first",
106 "testing/python/fixtures.py::TestFixtureMarker::test_parametrize_setup_function",
107 "testing/python/fixtures.py::TestFixtureMarker::test_parametrized_fixture_teardown_order",
108 "testing/python/fixtures.py::TestFixtureMarker::test_params_and_ids",
109 "testing/python/fixtures.py::TestFixtureMarker::test_params_and_ids_yieldfixture",
110 "testing/python/fixtures.py::TestFixtureMarker::test_register_only_with_mark",
111 "testing/python/fixtures.py::TestFixtureMarker::test_request_is_clean",
112 "testing/python/fixtures.py::TestFixtureMarker::test_scope_exc",
113 "testing/python/fixtures.py::TestFixtureMarker::test_scope_mismatch",
114 "testing/python/fixtures.py::TestFixtureMarker::test_scope_mismatch_various",
115 "testing/python/fixtures.py::TestFixtureMarker::test_scope_module_and_finalizer",
116 "testing/python/fixtures.py::TestFixtureMarker::test_scope_module_uses_session",
117 "testing/python/fixtures.py::TestFixtureMarker::test_scope_session",
118 "testing/python/fixtures.py::TestFixtureMarker::test_scope_session_exc",
119 "testing/python/fixtures.py::TestFixtureMarker::test_scope_session_exc_two_fix",
120 "testing/python/fixtures.py::TestFixtureUsages::test_factory_setup_as_classes_fails",
121 "testing/python/fixtures.py::TestFixtureUsages::test_factory_uses_unknown_funcarg_as_dependency_error",
122 "testing/python/fixtures.py::TestFixtureUsages::test_fixture_parametrized_with_iterator",
123 "testing/python/fixtures.py::TestFixtureUsages::test_funcarg_parametrized_and_used_twice",
124 "testing/python/fixtures.py::TestFixtureUsages::test_invalid_scope",
125 "testing/python/fixtures.py::TestFixtureUsages::test_noargfixturedec",
126 "testing/python/fixtures.py::TestFixtureUsages::test_receives_funcargs",
127 "testing/python/fixtures.py::TestFixtureUsages::test_receives_funcargs_scope_mismatch",
128 "testing/python/fixtures.py::TestFixtureUsages::test_receives_funcargs_scope_mismatch_issue660",
129 "testing/python/fixtures.py::TestFixtureUsages::test_request_can_be_overridden",
130 "testing/python/fixtures.py::TestFixtureUsages::test_request_instance_issue203",
131 "testing/python/fixtures.py::TestFixtureUsages::test_setup_functions_as_fixtures",
132 "testing/python/fixtures.py::TestFixtureUsages::test_usefixtures_ini",
133 "testing/python/fixtures.py::TestFixtureUsages::test_usefixtures_marker",
134 "testing/python/fixtures.py::TestFixtureUsages::test_usefixtures_seen_in_showmarkers",
135 "testing/python/fixtures.py::TestParameterizedSubRequest::test_call_from_fixture",
136 "testing/python/fixtures.py::TestParameterizedSubRequest::test_call_from_test",
137 "testing/python/fixtures.py::TestParameterizedSubRequest::test_external_fixture",
138 "testing/python/fixtures.py::TestParameterizedSubRequest::test_non_relative_path",
139 "testing/python/fixtures.py::TestRequestBasic::test_fixtures_sub_subdir_normalize_sep",
140 "testing/python/fixtures.py::TestRequestBasic::test_funcargnames_compatattr",
141 "testing/python/fixtures.py::TestRequestBasic::test_getfixturevalue[getfixturevalue]",
142 "testing/python/fixtures.py::TestRequestBasic::test_getfixturevalue[getfuncargvalue]",
143 "testing/python/fixtures.py::TestRequestBasic::test_getfixturevalue_recursive",
144 "testing/python/fixtures.py::TestRequestBasic::test_getfixturevalue_teardown",
145 "testing/python/fixtures.py::TestRequestBasic::test_newstyle_with_request",
146 "testing/python/fixtures.py::TestRequestBasic::test_request_addfinalizer",
147 "testing/python/fixtures.py::TestRequestBasic::test_request_addfinalizer_failing_setup",
148 "testing/python/fixtures.py::TestRequestBasic::test_request_addfinalizer_failing_setup_module",
149 "testing/python/fixtures.py::TestRequestBasic::test_request_addfinalizer_partial_setup_failure",
150 "testing/python/fixtures.py::TestRequestBasic::test_request_attributes",
151 "testing/python/fixtures.py::TestRequestBasic::test_request_attributes_method",
152 "testing/python/fixtures.py::TestRequestBasic::test_request_contains_funcarg_arg2fixturedefs",
153 "testing/python/fixtures.py::TestRequestBasic::test_request_fixturenames",
154 "testing/python/fixtures.py::TestRequestBasic::test_request_fixturenames_dynamic_fixture",
155 "testing/python/fixtures.py::TestRequestBasic::test_request_garbage",
156 "testing/python/fixtures.py::TestRequestBasic::test_request_getmodulepath",
157 "testing/python/fixtures.py::TestRequestBasic::test_request_subrequest_addfinalizer_exceptions",
158 "testing/python/fixtures.py::TestRequestBasic::test_setupcontext_no_param",
159 "testing/python/fixtures.py::TestRequestBasic::test_setupdecorator_and_xunit",
160 "testing/python/fixtures.py::TestRequestBasic::test_show_fixtures_color_yes",
161 "testing/python/fixtures.py::TestRequestMarking::test_accesskeywords",
162 "testing/python/fixtures.py::TestRequestMarking::test_accessmarker_dynamic",
163 "testing/python/fixtures.py::TestRequestMarking::test_applymarker",
164 "testing/python/fixtures.py::TestRequestScopeAccess::test_funcarg[class-module",
165 "testing/python/fixtures.py::TestRequestScopeAccess::test_funcarg[function-module",
166 "testing/python/fixtures.py::TestRequestScopeAccess::test_funcarg[module-module",
167 "testing/python/fixtures.py::TestRequestScopeAccess::test_funcarg[session--fspath",
168 "testing/python/fixtures.py::TestRequestScopeAccess::test_setup[class-module",
169 "testing/python/fixtures.py::TestRequestScopeAccess::test_setup[function-module",
170 "testing/python/fixtures.py::TestRequestScopeAccess::test_setup[module-module",
171 "testing/python/fixtures.py::TestRequestScopeAccess::test_setup[session--fspath",
172 "testing/python/fixtures.py::TestScopeOrdering::test_func_closure_all_scopes_complex",
173 "testing/python/fixtures.py::TestScopeOrdering::test_func_closure_module",
174 "testing/python/fixtures.py::TestScopeOrdering::test_func_closure_module_auto[autouse]",
175 "testing/python/fixtures.py::TestScopeOrdering::test_func_closure_module_auto[mark]",
176 "testing/python/fixtures.py::TestScopeOrdering::test_func_closure_same_scope_closer_root_first",
177 "testing/python/fixtures.py::TestScopeOrdering::test_func_closure_scopes_reordered",
178 "testing/python/fixtures.py::TestScopeOrdering::test_func_closure_with_native_fixtures",
179 "testing/python/fixtures.py::TestScopeOrdering::test_multiple_packages",
180 "testing/python/fixtures.py::TestShowFixtures::test_fixture_disallow_twice",
181 "testing/python/fixtures.py::TestShowFixtures::test_funcarg_compat",
182 "testing/python/fixtures.py::TestShowFixtures::test_show_fixtures_conftest[False]",
183 "testing/python/fixtures.py::TestShowFixtures::test_show_fixtures_conftest[True]",
184 "testing/python/fixtures.py::TestShowFixtures::test_show_fixtures_different_files",
185 "testing/python/fixtures.py::TestShowFixtures::test_show_fixtures_indented_doc",
186 "testing/python/fixtures.py::TestShowFixtures::test_show_fixtures_indented_doc_first_line_unindented",
187 "testing/python/fixtures.py::TestShowFixtures::test_show_fixtures_indented_in_class",
188 "testing/python/fixtures.py::TestShowFixtures::test_show_fixtures_testmodule",
189 "testing/python/fixtures.py::TestShowFixtures::test_show_fixtures_trimmed_doc",
190 "testing/python/fixtures.py::TestShowFixtures::test_show_fixtures_with_same_name",
191 "testing/python/fixtures.py::test_call_fixture_function_error",
192 "testing/python/fixtures.py::test_getfuncargnames",
193 "testing/python/fixtures.py::test_pytest_fixture_setup_and_post_finalizer_hook"
194 ],
195 "environment_setup_commit": "4ccaa987d47566e3907f2f74167c4ab7997f622f",
196 "patch": "diff --git a/src/_pytest/python.py b/src/_pytest/python.py\n--- a/src/_pytest/python.py\n+++ b/src/_pytest/python.py\n@@ -1342,17 +1342,19 @@ def _showfixtures_main(config, session):\n currentmodule = module\n if verbose <= 0 and argname[0] == \"_\":\n continue\n+ tw.write(argname, green=True)\n+ if fixturedef.scope != \"function\":\n+ tw.write(\" [%s scope]\" % fixturedef.scope, cyan=True)\n if verbose > 0:\n- funcargspec = \"%s -- %s\" % (argname, bestrel)\n- else:\n- funcargspec = argname\n- tw.line(funcargspec, green=True)\n+ tw.write(\" -- %s\" % bestrel, yellow=True)\n+ tw.write(\"\\n\")\n loc = getlocation(fixturedef.func, curdir)\n doc = fixturedef.func.__doc__ or \"\"\n if doc:\n write_docstring(tw, doc)\n else:\n tw.line(\" %s: no docstring available\" % (loc,), red=True)\n+ tw.line()\n \n \n def write_docstring(tw, doc, indent=\" \"):\n",
197 "pr_link": "https://github.com/pytest-dev/pytest/pull/5221"
198 }
199}