Example #1
0
File: run.py Project: RauliL/snek
def idle_showwarning_subproc(message, category, filename, lineno, file=None, line=None):
    """Show Idle-format warning after replacing warnings.showwarning.

    The only difference is the formatter called.
    """
    if file is None:
        file = sys.stderr
    try:
        file.write(pyshell.idle_formatwarning(message, category, filename, lineno, line))
    except IOError:
        pass  # the file (probably stderr) is invalid - this warning gets lost.
Example #2
0
File: run.py Project: zwm/cpython
def idle_showwarning_subproc(message,
                             category,
                             filename,
                             lineno,
                             file=None,
                             line=None):
    """Show Idle-format warning after replacing warnings.showwarning.

    The only difference is the formatter called.
    """
    if file is None:
        file = sys.stderr
    try:
        file.write(
            pyshell.idle_formatwarning(message, category, filename, lineno,
                                       line))
    except IOError:
        pass  # the file (probably stderr) is invalid - this warning gets lost.
Example #3
0
 def test_idle_formatter(self):
     # Will fail if format changed without regenerating idlemsg
     s = shell.idle_formatwarning(
             'Test', UserWarning, 'test_warning.py', 99, 'Line of code')
     self.assertEqual(idlemsg, s)
Example #4
0
 def test_idle_formatter(self):
     s = shell.idle_formatwarning('Test', UserWarning, 'test_warning.py',
                                  99, 'Line of code')
     self.assertEqual(idlemsg, s)