call site 0 for compat.doctest.DocTestRunner.__init__
test/testing/test_doctest.py - line 23
16
17
18
19
20
21
22
23
   def test_simple_docteststring_failing():
       testitem = DoctestText(name="dummy2", parent=None)
       testitem._setcontent("""
       >>> i = 0
       >>> i + 1
       2
       """)
->     py.test.raises(Failed, "testitem.run()")
test/raises.py - line 20
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
   def raises(ExpectedException, *args, **kwargs):
       """ raise AssertionError, if target code does not raise the expected
           exception.
       """
       assert args
       __tracebackhide__ = True 
       if isinstance(args[0], str):
           expr, = args
           assert isinstance(expr, str)
           frame = sys._getframe(1)
           loc = frame.f_locals.copy()
           loc.update(kwargs)
           #print "raises frame scope: %r" % frame.f_locals
           source = py.code.Source(expr)
           try:
->             exec source.compile() in frame.f_globals, loc
               #del __traceback__
               # XXX didn'T mean f_globals == f_locals something special?
               #     this is destroyed here ...
           except ExpectedException:
               return py.code.ExceptionInfo()
       else:
           func = args[0]
           assert callable
           try:
               func(*args[1:], **kwargs)
               #del __traceback__
           except ExpectedException:
               return py.code.ExceptionInfo()
           k = ", ".join(["%s=%r" % x for x in kwargs.items()])
           if k:
               k = ', ' + k
           expr = '%s(%r%s)' %(func.__name__, args, k)
       raise ExceptionFailure(msg="DID NOT RAISE", 
                              expr=args, expected=ExpectedException) 
None</build/buildd/codespeak-lib-0.9.1/py/test/raises.py:20> - line 1
1
-> testitem.run()
test/doctest.py - line 26
18
19
20
21
22
23
24
25
26
   def run(self):
       mod = py.std.types.ModuleType(self.name) 
       #for line in s.split('\n'): 
       #    if line.startswith(prefix): 
       #        exec py.code.Source(line[len(prefix):]).compile() in mod.__dict__ 
       #        line = ""
       #    else: 
       #        l.append(line)
->     self.execute(mod, self._content) 
test/doctest.py - line 30
28
29
30
31
32
33
   def execute(self, mod, docstring):
       mod.__doc__ = docstring 
->     failed, tot = py.compat.doctest.testmod(mod, verbose=1)
       if failed: 
           py.test.fail("doctest %s: %s failed out of %s" %(
                        self.fspath, failed, tot))
compat/doctest.py - line 1844
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
   def testmod(m=None, name=None, globs=None, verbose=None, isprivate=None,
               report=True, optionflags=0, extraglobs=None,
               raise_on_error=False, exclude_empty=False):
       """m=None, name=None, globs=None, verbose=None, isprivate=None,
          report=True, optionflags=0, extraglobs=None, raise_on_error=False,
          exclude_empty=False
   
       Test examples in docstrings in functions and classes reachable
       from module m (or the current module if m is not supplied), starting
       with m.__doc__.  Unless isprivate is specified, private names
       are not skipped.
   
       Also test examples reachable from dict m.__test__ if it exists and is
       not None.  m.__test__ maps names to functions, classes and strings;
       function and class docstrings are tested even if the name is private;
       strings are tested directly, as if they were docstrings.
   
       Return (#failures, #tests).
   
       See doctest.__doc__ for an overview.
   
       Optional keyword arg "name" gives the name of the module; by default
       use m.__name__.
   
       Optional keyword arg "globs" gives a dict to be used as the globals
       when executing examples; by default, use m.__dict__.  A copy of this
       dict is actually used for each docstring, so that each docstring's
       examples start with a clean slate.
   
       Optional keyword arg "extraglobs" gives a dictionary that should be
       merged into the globals that are used to execute examples.  By
       default, no extra globals are used.  This is new in 2.4.
   
       Optional keyword arg "verbose" prints lots of stuff if true, prints
       only failures if false; by default, it's true iff "-v" is in sys.argv.
   
       Optional keyword arg "report" prints a summary at the end when true,
       else prints nothing at the end.  In verbose mode, the summary is
       detailed, else very brief (in fact, empty if all tests passed).
   
       Optional keyword arg "optionflags" or's together module constants,
       and defaults to 0.  This is new in 2.3.  Possible values (see the
       docs for details):
   
           DONT_ACCEPT_TRUE_FOR_1
           DONT_ACCEPT_BLANKLINE
           NORMALIZE_WHITESPACE
           ELLIPSIS
           IGNORE_EXCEPTION_DETAIL
           REPORT_UDIFF
           REPORT_CDIFF
           REPORT_NDIFF
           REPORT_ONLY_FIRST_FAILURE
   
       Optional keyword arg "raise_on_error" raises an exception on the
       first unexpected exception or failure. This allows failures to be
       post-mortem debugged.
   
       Deprecated in Python 2.4:
       Optional keyword arg "isprivate" specifies a function used to
       determine whether a name is private.  The default function is
       treat all functions as public.  Optionally, "isprivate" can be
       set to doctest.is_private to skip over functions marked as private
       using the underscore naming convention; see its docs for details.
   
       Advanced tomfoolery:  testmod runs methods of a local instance of
       class doctest.Tester, then merges the results into (or creates)
       global Tester instance doctest.master.  Methods of doctest.master
       can be called directly too, if you want to do something unusual.
       Passing report=0 to testmod is especially useful then, to delay
       displaying a summary.  Invoke doctest.master.summarize(verbose)
       when you're done fiddling.
       """
       global master
   
       if isprivate is not None:
           warnings.warn("the isprivate argument is deprecated; "
                         "examine DocTestFinder.find() lists instead",
                         DeprecationWarning)
   
       # If no module was given, then use __main__.
       if m is None:
           # DWA - m will still be None if this wasn't invoked from the command
           # line, in which case the following TypeError is about as good an error
           # as we should expect
           m = sys.modules.get('__main__')
   
       # Check that we were actually given a module.
       if not inspect.ismodule(m):
           raise TypeError("testmod: module required; %r" % (m,))
   
       # If no name was given, then use the module's name.
       if name is None:
           name = m.__name__
   
       # Find, parse, and run all tests in the given module.
       finder = DocTestFinder(_namefilter=isprivate, exclude_empty=exclude_empty)
   
       if raise_on_error:
           runner = DebugRunner(verbose=verbose, optionflags=optionflags)
       else:
->         runner = DocTestRunner(verbose=verbose, optionflags=optionflags)
   
       for test in finder.find(m, name, globs=globs, extraglobs=extraglobs):
           runner.run(test)
   
       if report:
           runner.summarize()
   
       if master is None:
           master = runner
       else:
           master.merge(runner)
   
       return runner.failures, runner.tries