aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_exceptions.py
Commit message (Collapse)AuthorAgeFilesLines
* Include URI in traceback if filename is unknownMartin von Gagern2019-07-081-6/+44
| | | | | | | | | | | | | | | | | Using URIs as entrered will make the stack trace arguably more readable than using the module name which is the URI with non-word characters replaced by underscores. This change also fixes a mistake where a mods cache hit would not update template_filename, causing a stale filename to be displayed if the stack trace alternates between different templates. There now is a test case for this. Closes: #298 Pull-request: https://github.com/sqlalchemy/mako/pull/298 Pull-request-sha: ea35208d504932561711cdb574ec1f7def1e7060 Change-Id: Ieb606f6b6b7f4602d4d56694dd0bccf6dc287d20
* Correctly track line numbers for multi-line code blocksMartin von Gagern2019-07-011-0/+48
| | | | | | | | | | | | | | | | Improved the line-number tracking for source lines inside of Python ``<% ... %>`` blocks, such that text- and HTML-formatted exception traces such as that of :func:`.html_error_template` now report the correct source line inside the block, rather than the first line of the block itself. Exceptions in ``<%! ... %>`` blocks which get raised while loading the module are still not reported correctly, as these are handled before the Mako code is generated. Pull request courtesy Martin von Gagern. Closes: #297 Pull-request: https://github.com/sqlalchemy/mako/pull/297 Pull-request-sha: 60ad749604f8de0a9b8133430995045a93d0939c Change-Id: I2086e4370e8e2db7099de01743840286f0160efc
* Remove all non-essential functions from _ast_util.pyMike Bayer2019-06-031-4/+12
| | | | | | | | | | | | | As this is an old module that keeps changing with new Python releases, combined with the fact that we no longer use "import *", remove all unused functions from this module so that the list of imports we are maintaining is much shorter. Python 3.8 is also added to tox.ini with more adjustments to test_exceptions to accommodate for quoting differences. Fixes: #296 Change-Id: I0cea7d21ecb2be9335e0845ae7fbd06d468a137b
* Use tox / zimportsMike Bayer2019-05-311-104/+183
| | | | Change-Id: Ia047c7052a6d242c2cf1c7a83981f1e38ea4d928
* Use utf-8 encoding for traceback source with no encoding in py3kMike Bayer2019-05-091-0/+9
| | | | | | | | | | Added a default encoding of "utf-8" when the :class:`.RichTraceback` object retrieves Python source lines from a Python traceback; as these are bytes in Python 3 they need to be decoded so that they can be formatted in the template. Fixes: #293 Change-Id: I41a5c09422d6500c7cab2423ed14ac951a64e2f4
* - exception test fixes for more recent pygmentsMike Bayer2017-05-221-2/+2
| | | | Change-Id: Ibdfe5b2f2f3d1426921bcadf6740ae065ed0833b
* - reduce the pygments strings we're searching for to accommodate forMike Bayer2016-03-091-26/+8
| | | | | | changes in pygments formatting; we might be losing a bit of what was tested here originally but we still assert pygments is taking place.
* - will now be 1.0Mike Bayer2014-04-281-4/+1
| | | | | - drop python 2.4, 2.5 support - various pep8ing
* Fix docstrings to use "UTF-8" instead of "utf8"Martin Geisler2013-08-281-2/+2
| | | | | | | | | | | The UTF-8 FAQ says this is the correct name for the encoding. http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 The official name and spelling of this encoding is UTF-8, where UTF stands for UCS Transformation Format. Please do not write UTF-8 in any documentation text in other ways (such as utf8 or UTF_8), unless of course you refer to a variable name and not the encoding itself.
* - [bug] Fixed bug whereby an exception in Python 3Mike Bayer2013-02-201-1/+12
| | | | | | against a module compiled to the filesystem would fail trying to produce a RichTraceback due to the content being in bytes. [ticket:209]
* - get the pygments install to be easily switched on/offMike Bayer2012-11-121-9/+9
| | | | | - fix test_exceptions to always call non-pygments tests - update test for py3k transition
* py2.5 worksMike Bayer2012-11-111-4/+4
|
* all tests pass on py3k and py2.7. py2.5/2.4 nextMike Bayer2012-11-111-4/+4
|
* - first pass at running a py3k compatible base in py2k as well.Mike Bayer2012-11-111-32/+31
| | | | | having some weird unicode issues I can't debug; the meaning of str.encode() seems to be changing globally somehow
* - clean up test exclusionsMike Bayer2012-09-051-17/+21
|
* - remove context manager to allow 2.5 and 2.4 to work, [ticket:188]Mike Bayer2012-04-131-63/+116
| | | | | - add conditionals to pygments-dependent tests that ensure pygments 1.4, separate check for no pygments.
* fix two py3k failuresMike Bayer2012-03-301-1/+1
|
* Fixed two tests in test_exceptionsBenjamin Trofatter2012-03-241-4/+4
| | | | | | Corrected the success conditions of test_utf8_html_error_template and test_utf8_format_exceptions when testing in py2.x without pygments to match the currently expected output.
* - [feature] The html_error_template() will nowMike Bayer2012-03-121-8/+57
| | | | | | | apply Pygments highlighting to the source code displayed in the traceback, if Pygments if available. Courtesy Ben Trofatter [ticket:95]
* py3k fixesrel_0_6_2Mike Bayer2012-02-021-2/+8
|
* - [bug] The exception message in the html_error_templateMike Bayer2012-01-161-8/+7
| | | | is now escaped with the HTML filter. [ticket:142]
* - now that trailing whitespace comes up in red, need to get rid of itMike Bayer2011-01-191-13/+13
|
* - Now using MarkupSafe for HTML escaping,Mike Bayer2010-06-221-8/+8
| | | | | | | | | | | | | | | | i.e. in place of cgi.escape(). Faster C-based implementation and also escapes single quotes for additional security. Supports the __html__ attribute for the given expression as well. When using "disable_unicode" mode, a pure Python HTML escaper function is used which also quotes single quotes. Note that Pylons by default doesn't use Mako's filter - check your environment.py file.
* py3k test fixesMike Bayer2010-06-221-3/+4
|
* - Fixed call to "unicode.strip" inMike Bayer2010-06-221-4/+16
| | | | | exceptions.text_error_template which is not Py3k compatible. [ticket:137]
* - Added conditional to RichTracebackMike Bayer2010-05-311-6/+26
| | | | | | | | | such that if no traceback is passed and sys.exc_info() has been reset, the formatter just returns blank for the "traceback" portion. [ticket:135] - some long line cleanup
* fix test to use correct parameterMike Bayer2010-04-211-2/+2
|
* - Fixed error formatting when a stacktraceMike Bayer2010-04-171-0/+10
| | | | | | line contains no line number, as in when inside an eval/exec-generated function. [ticket:132]
* README cleanup, fix a new test for py3kMike Bayer2010-03-051-1/+1
|
* - RichTraceback(), html_error_template().render(),Mike Bayer2010-03-051-4/+24
| | | | | | text_error_template().render() now accept "error" and "traceback" as optional arguments, and these are now actually used. [ticket:122]
* - merged -r481:499 of py3k branch.Mike Bayer2010-03-041-19/+40
| | | | | | - Python 3 support is added ! See README.py3k for installation and testing notes. [ticket:119]
* - Unit tests now run with nose. [ticket:127]Mike Bayer2010-02-051-0/+105