New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvements to JProxy #470
Conversation
Regarding the test organization question, I'd also prefer small tests (actually as small as possible) to keep things tidied up. |
Due to compatibility issues with Python 2.7 JProxy only takes the form @marscher Post this pull request a memory leak was discovered proxy implementation, but it will require a significant pull request to correct it. None of the JProxy code checks for a cyclic dependency in the instance. As there is no GC methods on that class there is no way that it can ever clean up if the Proxy is referred to either in the inst, dict, or Implements forms. I can try to clean up the problem as I worked through the issue in JPype 0.8 core. But it will take me at least a day or two to finish it. |
Merging this so that the string pull can be made fresh. |
Fixes the problem reported by the user and give the test bench some TLC as this and a bunch of other things were being missed. There were a lot of cases in this area where one form or another was not tested. Fixing it took much longer than expected because all of the corner cases (must be list[str or JClass], or str, or JClass, but all must resolve to JInterface).
Note. This does make the change that both bare lists and defined lists are accepted in the old JProxy interface.
I wanted the new interface to be simple (though specifying a list explicitly is also accepted)
I can kill the second form if it is too much.
This change may break the total nonsense form
JProxy(intf1, foo)
where dict is being implied as based on position, which should never have worked.A secondary change is it now reports an error on the old JProxy if either no interfaces are specified or the dict or inst is missing. Letting it quietly pass by this sort of error just to blow up later offends me.
The error message also became more terse. Giving the correct usage is the point of the documentation
and not the exception string. I added checks to the test bench to make sure the error was reported for the right reason rather than any reason. There needs to be an action item to do this universally, as people do get burned by deceptive messages.
@marscher general question, do you prefer many small tests that test each aspect of a function individually and thus report the exact failure by the test that failed, or large tests that test multiple aspects of a function? My personal preference is many small because otherwise I get burned when I fix something in a test and it just falls through the next part of the test. But I will defer to you as we are already over 400 tests.