diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-02-29 14:40:45 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-03-02 17:24:19 -0500 |
| commit | 57dc36a01b2b334a996f73f6a78b3bfbe4d9f2ec (patch) | |
| tree | 77cbb0199ca91be3b0816e3a5bd4c217e36a7d1b /test/aaa_profiling | |
| parent | 649de79950dcf952d7a44069faf36925c23c4e63 (diff) | |
| download | sqlalchemy-57dc36a01b2b334a996f73f6a78b3bfbe4d9f2ec.tar.gz | |
Ensure all nested exception throws have a cause
Applied an explicit "cause" to most if not all internally raised exceptions
that are raised from within an internal exception catch, to avoid
misleading stacktraces that suggest an error within the handling of an
exception. While it would be preferable to suppress the internally caught
exception in the way that the ``__suppress_context__`` attribute would,
there does not as yet seem to be a way to do this without suppressing an
enclosing user constructed context, so for now it exposes the internally
caught exception as the cause so that full information about the context
of the error is maintained.
Fixes: #4849
Change-Id: I55a86b29023675d9e5e49bc7edc5a2dc0bcd4751
Diffstat (limited to 'test/aaa_profiling')
| -rw-r--r-- | test/aaa_profiling/test_memusage.py | 14 | ||||
| -rw-r--r-- | test/aaa_profiling/test_resultset.py | 2 |
2 files changed, 15 insertions, 1 deletions
diff --git a/test/aaa_profiling/test_memusage.py b/test/aaa_profiling/test_memusage.py index 55890cd06..8f84acde8 100644 --- a/test/aaa_profiling/test_memusage.py +++ b/test/aaa_profiling/test_memusage.py @@ -1124,6 +1124,20 @@ class CycleTest(_fixtures.FixtureTest): go() + def test_raise_from(self): + @assert_cycles() + def go(): + try: + try: + raise KeyError("foo") + except KeyError as ke: + + util.raise_(Exception("oops"), from_=ke) + except Exception as err: # noqa + pass + + go() + def test_query_alias(self): User, Address = self.classes("User", "Address") configure_mappers() diff --git a/test/aaa_profiling/test_resultset.py b/test/aaa_profiling/test_resultset.py index 87908f016..73a1a8b6f 100644 --- a/test/aaa_profiling/test_resultset.py +++ b/test/aaa_profiling/test_resultset.py @@ -111,7 +111,7 @@ class ResultSetTest(fixtures.TestBase, AssertsExecutionResults): "some other column", Integer ) - @profiling.function_call_count() + @profiling.function_call_count(variance=0.10) def go(): c1 in row |
