Skip to content

MemoryError using custom warning formatter in python 2.7 #3691

@Sup3rGeo

Description

@Sup3rGeo
  • pytest master
  • python 2.7
  • Windows 10

Running the following test makes pytest hang. Python uses the whole PC memory and eventually it exists with MemoryError:

# -*- coding: utf8 -*-
from __future__ import unicode_literals
import warnings
import pytest


def _custom_showwarning(message, *a, **b):
    return "WARNING: {}".format(message)

warnings.formatwarning = _custom_showwarning

@pytest.mark.filterwarnings("default")
def test_custom_warning_formatter():
    warnings.warn("¥")

Maybe I am doing something wrong here. This problems does not happen with python 3.6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueeasy issue that is friendly to new contributorplugin: warningsrelated to the warnings builtin plugintype: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions