idle,unit test and gravity

Chris Lyon chris.lyon at spritenote.co.uk
Thu May 1 04:58:29 EDT 2003


Hugh Beyer posted this on 9 Nov 2002:-


I'm trying out PyUnit as a framework for my tests and am finding it
tough
going... I'm sorry but it doesn't seem like TSTTCPW to *me*.

Right now I think I'm creating tests correctly and a test suite
correctly,
but when I run it with a TextTestRunner instance I get the following
dump:

Traceback (most recent call last):
  File "C:\\Jumanji\\AdSelectorTest.py", line 355, in ?
    unittest.main()
  File "C:\Python21\lib\unittest.py", line 663, in __init__
    self.runTests()
  File "C:\Python21\lib\unittest.py", line 700, in runTests
    result = self.testRunner.run(self.test)
  File "C:\Python21\lib\unittest.py", line 603, in run
    result.printErrors()
  File "C:\Python21\lib\unittest.py", line 568, in printErrors
    self.stream.writeln()
  File "C:\Python21\lib\unittest.py", line 513, in writeln
    self.write('\n') # text-mode streams translate to \r\n if needed
  File "C:\PYTHON21\Tools\idle\PyShell.py", line 676, in write
    self.shell.write(s, self.tags)
  File "C:\PYTHON21\Tools\idle\PyShell.py", line 662, in write
    self.text.mark_gravity("iomark", "right")
AttributeError: 'None' object has no attribute 'mark_gravity'

Last I checked, gravity here was Earth normal. I'm running
unitttest.main()
to set up the suite, but I get the same error if I create and run the
test
suite myself. Any ideas what's going wrong? This is python2.1 running
in
IDLE on a Win2000 system.

Thanks.

    Hugh

I have produced the same effect on win2000 in python 2.2.2 and seemed
to have narrowed it down to having closed the Interactive window after
a run of the unittest. The only way I've found out of it is to restart
idle.

On a small seperate point why do unittest's run within idle want to
close the entire application when they don't when run within
pythonwin? A small point but I feel the answer would be illuminating.

Chris




More information about the Python-list mailing list