4
from nose.config import Config
5
from nose.plugins import doctests
6
from mock import Bucket
8
class TestDoctestErrorHandling(unittest.TestCase):
11
self._path = sys.path[:]
12
here = os.path.dirname(__file__)
13
testdir = os.path.join(here, 'support', 'doctest')
14
sys.path.insert(0, testdir)
15
p = doctests.Doctest()
16
p.can_configure = True
17
p.configure(Bucket(), Config())
21
sys.path = self._path[:]
23
def test_no_doctests_in_file(self):
25
mod = __import__('no_doctests')
26
loaded = [ t for t in p.loadTestsFromModule(mod) ]
27
assert not loaded, "Loaded %s from empty module" % loaded
29
def test_err_doctests_raises_exception(self):
31
mod = __import__('err_doctests')
33
loaded = [ t for t in p.loadTestsFromModule(mod) ]
37
self.fail("Error doctests file did not raise ValueError")
39
if __name__ == '__main__':