On Thu, Nov 10, 2011 at 9:12 AM, Terry Brown <[email protected]> wrote:
> No biggie, but 4767 is giving
> double spaced logging to console.
That was fixed at rev 4768 several hours ago, before your report.
Later revs add unit tests.
I have *finally* discovered how to write proper, unobtrusive, unit
tests for g.pr, g.trace and g.es_print. Here is the test for g.pr::
'''Make sure that g.trace doesn't add an extra newline.'''
import sys
def test():
g.pr('a')
g.pr('b')
try:
sys.stdout = g.fileLikeObject()
test()
result = sys.stdout.get()
assert result == 'a\nb\n',repr(result)
finally:
sys.stdout = sys.__stdout__
Doh! Just redirect the output so it doesn't pollute the output from
the test runner.
This is an important example of making unit tests more weightless.
So this was a happy mistake.
On the list: remove dependencies on external files from all unit
tests. Such dependencies add considerable unwanted weight.
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/leo-editor?hl=en.