Re: [Pyobjc-dev] Running tests in one python session
Brought to you by:
ronaldoussoren
From: Ronald O. <ous...@ci...> - 2003-05-29 21:14:14
|
On Thursday, May 29, 2003, at 21:02 Europe/Amsterdam, Ronald Oussoren wrote: > > On Thursday, May 29, 2003, at 20:39 Europe/Amsterdam, bb...@ma... > wrote: > >> On Thursday, May 29, 2003, at 10:49 US/Pacific, Ronald Oussoren wrote: >>> - Add script to run all tests in 1 python session, this is a script >>> by >>> Dinu Gherman with minor updates by me. >> >> Excellent change -- much speedier, I presume. > > It is much speedier, and it caught more bugs than the previous script. > This is probably because the bridge gets to do more work in a single > session. > >> >> Is there still an option to run the tests in different sessions? > Sure, the previous script is still present. > >> >> We had some problems early on that were only caught because the >> different tests loaded things in different order or because one test >> could influence another test (classAddMethods(), for example). > > I've updated a number of tests (test_posing and test_methodedits): > They used to modify NSObject, which is not very usefull when those > classes will be used later on. Both currently use another Foundation > class and both should be changed to use a custom Objective-C class. > > BTW. test_posing should work with NSObject, but that causes a crash. > I'm working on this, until that is resolved I'll keep using a class > that isn't used by the other unittests. > > Posing also introduces another, possibly more serious, problem: If > someone poses as NSObject after you import Foundation, > Foundation.NSObject still references the original NSObject (which is > now %NSObject). This can be fixed for 'import Foundation', but not for > 'from Foundation import *'. Sadly enough the latter is how most peoply > import the module. I'm going to disable poseAs for now, getting it to work will be a lot of work: class_poseAs (the implementation of +poseAs:) copies the imposter class, and that won't work with our code (class-builder.m embeds the class into a larger structure and does pointer casts at several locations). The meta class isn't copied, and with some reordering in class-builder.m we could use that fact, but a comment in the implementation of class_poseAs claims that not copying the meta class is a hack. Relying on not copying the meta-class is probably unsafe. Ronald |