Skip to content

assertRaises contextManager behaves differently in python 2.6 #90

Open
@GoogleCodeExporter

Description

@GoogleCodeExporter
What steps will reproduce the problem?

The following test (for the JPype1 project  @ 
https://github.com/originell/jpype) works on python 2.7 and python 3 but fails 
in python 2.6:
        with self.assertRaises(JavaException) as cm:
            self.jpype.exc.ExceptionTest.throwRuntime()
        self.assertIs(cm.exception.javaClass(), java.lang.RuntimeException)

What is the expected output? What do you see instead?
I'm expecting it to work.

Traceback (most recent call last):

File "/home/travis/build/baztian/jpype/test/jpypetest/exc.py", line 31, in 
testExceptionThrown

self.assertIs(cm.exception.javaClass(), java.lang.RuntimeException)

AttributeError: 'tuple' object has no attribute 'javaClass'



What version of the product are you using? On what operating system?
0.8.0

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 12 Feb 2015 at 8:11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions