Skip to content

Commit 9edb9fd

Browse files
authored
Merge pytest-dev/pytest@master (#264)
2 parents c7f409d + 2d87475 commit 9edb9fd

File tree

9 files changed

+20
-38
lines changed

9 files changed

+20
-38
lines changed

changelog/6795.improvement.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Import usage error message with invalid `-o` option.

doc/en/_templates/globaltoc.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ <h3><a href="{{ pathto(master_doc) }}">{{ _('Table Of Contents') }}</a></h3>
2121
<hr>
2222
{{ toc }}
2323
{%- endif %}
24+
25+
<hr>
26+
<a href="{{ pathto('genindex') }}">Index</a>
27+
<hr>

doc/en/cache.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ the cache and nothing will be printed:
251251
test_caching.py:20: AssertionError
252252
1 failed in 0.12s
253253
254-
See the :fixture:`cache-api` for more details.
254+
See the :fixture:`config.cache fixture <config.cache>` for more details.
255255

256256

257257
Inspecting Cache content

doc/en/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@
208208
html_domain_indices = True
209209

210210
# If false, no index is generated.
211-
html_use_index = False
211+
html_use_index = True
212212

213213
# If true, the index is split into individual pages for each letter.
214214
# html_split_index = False

doc/en/plugins.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ Here is a little annotated list for some popular plugins:
4141
* `pytest-instafail <https://pypi.org/project/pytest-instafail/>`_:
4242
to report failures while the test run is happening.
4343

44-
* `pytest-bdd <https://pypi.org/project/pytest-bdd/>`_ and
45-
`pytest-konira <https://pypi.org/project/pytest-konira/>`_
44+
* `pytest-bdd <https://pypi.org/project/pytest-bdd/>`_:
4645
to write tests using behaviour-driven testing.
4746

4847
* `pytest-timeout <https://pypi.org/project/pytest-timeout/>`_:

doc/en/reference.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ For more details, consult the full :ref:`fixtures docs <fixture>`.
284284
:decorator:
285285

286286

287-
.. fixture:: cache
287+
.. fixture:: config.cache
288288

289289
config.cache
290290
~~~~~~~~~~~~

src/_pytest/config/__init__.py

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,7 +1132,11 @@ def _get_override_ini_value(self, name: str) -> Optional[str]:
11321132
try:
11331133
key, user_ini_value = ini_config.split("=", 1)
11341134
except ValueError:
1135-
raise UsageError("-o/--override-ini expects option=value style.")
1135+
raise UsageError(
1136+
"-o/--override-ini expects option=value style (got: {!r}).".format(
1137+
ini_config
1138+
)
1139+
)
11361140
else:
11371141
if key == name:
11381142
value = user_ini_value
@@ -1198,28 +1202,6 @@ def _warn_about_missing_assertion(mode):
11981202
)
11991203

12001204

1201-
def setns(obj, dic):
1202-
import pytest
1203-
1204-
for name, value in dic.items():
1205-
if isinstance(value, dict):
1206-
mod = getattr(obj, name, None)
1207-
if mod is None:
1208-
modname = "pytest.%s" % name
1209-
mod = types.ModuleType(modname)
1210-
sys.modules[modname] = mod
1211-
mod.__all__ = []
1212-
setattr(obj, name, mod)
1213-
obj.__all__.append(name)
1214-
setns(mod, value)
1215-
else:
1216-
setattr(obj, name, value)
1217-
obj.__all__.append(name)
1218-
# if obj != pytest:
1219-
# pytest.__all__.append(name)
1220-
setattr(pytest, name, value)
1221-
1222-
12231205
def create_terminal_writer(config: Config, *args, **kwargs) -> TerminalWriter:
12241206
"""Create a TerminalWriter instance configured according to the options
12251207
in the config object. Every code which requires a TerminalWriter object

testing/test_config.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,8 +1120,12 @@ def test_override_ini_usage_error_bad_style(self, testdir):
11201120
xdist_strict=False
11211121
"""
11221122
)
1123-
result = testdir.runpytest("--override-ini", "xdist_strict True", "-s")
1124-
result.stderr.fnmatch_lines(["*ERROR* *expects option=value*"])
1123+
result = testdir.runpytest("--override-ini", "xdist_strict", "True")
1124+
result.stderr.fnmatch_lines(
1125+
[
1126+
"ERROR: -o/--override-ini expects option=value style (got: 'xdist_strict').",
1127+
]
1128+
)
11251129

11261130
@pytest.mark.parametrize("with_ini", [True, False])
11271131
def test_override_ini_handled_asap(self, testdir, with_ini):

testing/test_session.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -363,14 +363,6 @@ def test_one():
363363

364364

365365
def test_rootdir_wrong_option_arg(testdir):
366-
testdir.makepyfile(
367-
"""
368-
import os
369-
def test_one():
370-
assert 1
371-
"""
372-
)
373-
374366
result = testdir.runpytest("--rootdir=wrong_dir")
375367
result.stderr.fnmatch_lines(
376368
["*Directory *wrong_dir* not found. Check your '--rootdir' option.*"]

0 commit comments

Comments
 (0)