Re: [Pyunit-interest] PyUnitTestBrowser - Memory leak
Brought to you by:
purcell
From: Alexander G. <al...@in...> - 2002-06-04 03:40:23
|
On Mon, Jun 03, 2002 at 07:35:51PM -0700, Phlip wrote: > Alexander Garden sez: > > One complaint: > > - listage = glob.glob(os.path.join(folder, '*test*.py')) > > + listage = glob.glob(os.path.join(folder, '*.py')) > > > > I like the old line better. > > Sorry - that one was a request by an audience member. > > At work, our custom testrunner enforces a totally strict naming convention. > But to appeal to a mass market I have to be less narrow. > > I envision a browserConfig.py where one tweaks such constants by applying or > removing well-commented commented code. That would work, but it seems unobvious and cumbersome to me. Would I have to edit the file to change the pattern from the one I use to the one a colleague uses to the one some open source project uses? Ugh. That would be fine for a default, but not as the primary way. And I would like to press the point that a loose default could do damage. If I ran the latest code in some of my directories, stuff would get overwritten that I would *not* want overwritten. That would be bad. But one could blame me for that. :) It's probably a left over from my Perl habits. > As this is my first foray into authoring a tool others must use and patch, I > note with wry amusement how you take for granted the ability to "speak in > diffs". ;-) Can't imagine living without them. > > Or even better, > > + listage = sys.argv[1:] (Make that: listage = filter(lambda x: x[0] != '-', sys.argv[1:]) > > and let the user choose the pattern and the shell the expansion. > > Oookay. Now make them enter this: > > $ ./browser.py test\*.py > > The slash is not optional because we don't want your BASH or whatever to > expand the *. We need to expand it for you, recursively in each sub > directory. Like 'find'. Being a Unix guy, I'd much, much rather have the shell do the work of finding files for me. That's what it's good at. That's what it's there for, among other things. If I needed to recursively find files, I'd do $ ./browser.py `find . -name 'test*.py'` which is admittedly rather clumsy if one must type it often, but one shouldn't have to, right? :) And it is easily bound up into a shell script or alias anyway. Of course, that wouldn't work on Windows. A python wrapper script would work well enough over there, I suppose. It could work exactly as the current implementation works. It seems more flexible and cleaner to me to have the internals think in terms of a list of files and have an outer layer optionally do the conversion from directories and patterns to a file list than to build a pattern/directory thought structure into the core. If you decide to go this way, I'd be happy to help out with the refactoring. Alexander |