[issue11910] test_heapq C tests are not skipped when _heapq is missing

Raymond Hettinger report at bugs.python.org
Sun May 8 04:14:57 CEST 2011


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

Attaching a rough draft of a way to simplify dual path testing.  The idea is that the suite shouldn't have to be rewritten with self.module.heapify(...) references throughout.  Instead, tests are written normally and the only thing that changes in the context that they are executed in (not much different that if we simply commented out the import of c accelerator code).

Several things need work:
1) There needs to be a way to run only one block of tests if _heapqmodule isn't built.

2) the unittest.skipUnless decorator doesn't work (it does a static computation during compilation rather than a dynamic test during execution).  The attached rough draft code works around this by putting the skip logic inside the test.  This should be done more cleanly.

3) It would be great if there were a way to test unittest's test runner which version is being tested so that if there is a failure, it's obvious which context is being tested.

The patch is a proof-of-concept that would need polishing before becoming the preferred way of doing multiple path testing.

----------
Added file: http://bugs.python.org/file21932/new_heapq_test.patch

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


More information about the Python-bugs-list mailing list