Skip to content

Display test name in warning message when Monkeypatch.setenv/delenv use bytes keys #4082

@nicoddemus

Description

@nicoddemus

From #4056 (comment) by @gaborbernat:


Hey guys, would it be possible to also report at least the test that catches this? In tox now I get:

018-10-05T09:23:49.0704702Z =============================== warnings summary ===============================
2018-10-05T09:23:49.0705517Z /home/vsts/work/1/s/.tox/py27/lib/python2.7/site-packages/_pytest/monkeypatch.py:232: PytestWarning: Environment variable value local('/tmp/pytest-of-vsts/pytest-0/popen-gw0/test_substitution_jenkins_cont0') should be str, converted to str implicitly
2018-10-05T09:23:49.0705945Z   value
2018-10-05T09:23:49.0706652Z /home/vsts/work/1/s/.tox/py27/lib/python2.7/site-packages/_pytest/monkeypatch.py:232: PytestWarning: Environment variable value 1 should be str, converted to str implicitly

I have 450+ tests though leaving me puzzled where to fix it...


Seems easy, Monkeypatch might receive an optional nodeid object that is used in the message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueeasy issue that is friendly to new contributorplugin: monkeypatchrelated to the monkeypatch builtin plugintype: enhancementnew feature or API change, should be merged into features branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions