Re: [Pyobjc-dev] Dumb Question about objc.loadBundle
Brought to you by:
ronaldoussoren
From: Ronald O. <ous...@ci...> - 2003-08-10 15:50:52
|
On Sunday, 10 August, 2003, at 17:00, Pierce T. Wetter III wrote: > > So I want to use PyObjC in order to create unit tests, simple tools, > etc. using our custom framework. > > Given that I'd like to use PyUnit (unittest) for all this, that means > I'l be writing lots of little python files that define a unit test > class and have: > > > if __name__ == "__main__": > runTest() > > So the tests can be run individually from the command line, or via a > test tool, or various grouping scripts will import other tests and run > them a group. > > The gotcha for me is that loadBundle both loads the framework, and > exports/imports the symbols. In other words, its a little heavier of > an operation then just an import. > > So my dumb question: > > Let's say I have a bunch of test files: > > test1,py, test2,py, test3,py, > > All with: > > #!/usr/local/bin/python > import random > import objc > import Foundation > from Foundation import NSCalendarDate > NSCalendarDate.distantPast() > > objc.loadBundle("EOAccess", > globals(),bundle_path='/System/Library/Frameworks/EOAccess.framework') > objc.loadBundle("EOControl", > globals(),bundle_path='/System/Library/Frameworks/ > EOControl.framework') > objc.loadBundle("exim", > globals(),bundle_path='/Marketocracy/Frameworks/exim.framework') > objc.loadBundle("MChannel", > globals(),bundle_path='/Marketocracy/Frameworks/MChannel.framework') > objc.loadBundle("MRPC", > globals(),bundle_path='/Marketocracy/Frameworks/MRPC.framework') > objc.loadBundle("StandardAndPoors", > globals(),bundle_path='/Marketocracy/Frameworks/ > StandardAndPoors.framework') > objc.loadBundle("MFoundation", > globals(),bundle_path='/Marketocracy/Frameworks/ > MFoundation.framework') > objc.loadBundle("ObjectModel", > globals(),bundle_path='/Marketocracy/Frameworks/ > ObjectModel.framework') > > At the top. I'd create a seperate python module (or even several modules) that perform(s) the calls to loadBundle. That would make it easier to access the frameworks from other scripts. > > Will the extra "loadBundle" calls cause me problems? It shouldn't cause problems. Ronald |