[issue18189] IDLE Improvements: Unit test for Delegator.py

R. Jayakrishnan report at bugs.python.org
Mon Jun 17 21:22:43 CEST 2013


R. Jayakrishnan added the comment:

The "from test.resource import requires" give me errors saying no module named resource in test (Am I missing anything?)
For the moment I use "from test.support import requires" as in test_delegator1.patch
..... 
from test.support import requires
requires('gui')
class Test_delegator(unittest.TestCase):

    def setUp(self):
        .....

The results follows
---------------------------

jaykrish at jaykrish-Vostro-1520:~/gsoc/cpy/cpython$ ./python -m test -ugui test_idle
[1/1] test_idle
1 test OK.
[189373 refs]

--------------------------
jaykrish at jaykrish-Vostro-1520:~/gsoc/cpy/cpython$ ./python -m test test_idle
[1/1] test_idle
test test_idle failed -- Traceback (most recent call last):
  File "/home/jaykrish/gsoc/cpy/cpython/Lib/unittest/case.py", line 384, in _executeTestPart
    function()
  File "/home/jaykrish/gsoc/cpy/cpython/Lib/unittest/loader.py", line 32, in testFailure
    raise exception
ImportError: Failed to import test module: idlelib.idle_test.test_delegator
Traceback (most recent call last):
  File "/home/jaykrish/gsoc/cpy/cpython/Lib/unittest/loader.py", line 261, in _find_tests
    module = self._get_module_from_name(name)
  File "/home/jaykrish/gsoc/cpy/cpython/Lib/unittest/loader.py", line 239, in _get_module_from_name
    __import__(name)
  File "/home/jaykrish/gsoc/cpy/cpython/Lib/idlelib/idle_test/test_delegator.py", line 8, in <module>
    requires('gui')
  File "/home/jaykrish/gsoc/cpy/cpython/Lib/test/support.py", line 390, in requires
    raise ResourceDenied(msg)
test.support.ResourceDenied: Use of the 'gui' resource not enabled


1 test failed:
    test_idle
[189233 refs]
---------------------------


And yes, the teardown method using self.root.destroy() now.

----------
Added file: http://bugs.python.org/file30626/test_delegator1.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18189>
_______________________________________


More information about the Python-bugs-list mailing list