Commit Graph

82 Commits

Author SHA1 Message Date
Ezio Melotti c2077b0d9b #11565: Fix several typos. Patch by Piotr Kasprzyk. 2011-03-16 12:34:31 +02:00
Florent Xicluna 80800d3571 Fix the issue with non-ascii char in doctest. Issue #9409
Recorded merge of revisions 85495,85500 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85495 | florent.xicluna | 2010-10-14 22:56:20 +0200 (jeu., 14 oct. 2010) | 3 lines

  Fix the regex to match all kind of filenames, for interactive debugging in doctests. (issue #9409)
........
  r85500 | florent.xicluna | 2010-10-14 23:35:58 +0200 (jeu., 14 oct. 2010) | 2 lines

  Add test case for issue #9409, non-ascii char in doctest.  It passes in 3.2 but needs fixing in 2.7.
........
2010-10-14 21:46:04 +00:00
Florent Xicluna b67660fcce Merged revisions 85495 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85495 | florent.xicluna | 2010-10-14 22:56:20 +0200 (jeu., 14 oct. 2010) | 3 lines

  Fix the regex to match all kind of filenames, for interactive debugging in doctests. (issue #9409)
........
2010-10-14 21:10:45 +00:00
Georg Brandl 507759904c Merged revisions 83259,83261,83264-83265,83268-83269,83271-83272,83281 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r83259 | georg.brandl | 2010-07-30 09:03:39 +0200 (Fr, 30 Jul 2010) | 1 line

  Clarification.
........
  r83261 | georg.brandl | 2010-07-30 09:21:26 +0200 (Fr, 30 Jul 2010) | 1 line

  #9230: allow Pdb.checkline() to be called without a current frame, for setting breakpoints before starting debugging.
........
  r83264 | georg.brandl | 2010-07-30 10:45:26 +0200 (Fr, 30 Jul 2010) | 1 line

  Document the "jump" command in pdb.__doc__, and add a version tag for "until X".
........
  r83265 | georg.brandl | 2010-07-30 10:54:49 +0200 (Fr, 30 Jul 2010) | 1 line

  #8015: fix crash when entering an empty line for breakpoint commands.  Also restore environment properly when an exception occurs during the definition of commands.
........
  r83268 | georg.brandl | 2010-07-30 11:23:23 +0200 (Fr, 30 Jul 2010) | 2 lines

  Issue #8048: Prevent doctests from failing when sys.displayhook has
  been reassigned.
........
  r83269 | georg.brandl | 2010-07-30 11:43:00 +0200 (Fr, 30 Jul 2010) | 1 line

  #6719: In pdb, do not stop somewhere in the encodings machinery if the source file to be debugged is in a non-builtin encoding.
........
  r83271 | georg.brandl | 2010-07-30 11:59:28 +0200 (Fr, 30 Jul 2010) | 1 line

  #5727: Restore the ability to use readline when calling into pdb in doctests.
........
  r83272 | georg.brandl | 2010-07-30 12:29:19 +0200 (Fr, 30 Jul 2010) | 1 line

  #5294: Fix the behavior of pdb "continue" command when called in the top-level debugged frame.
........
  r83281 | georg.brandl | 2010-07-30 15:36:43 +0200 (Fr, 30 Jul 2010) | 1 line

  Add myself for pdb.
........
2010-08-01 19:33:15 +00:00
Georg Brandl 1f05e2e9ba #8471: reset _SpoofOut.buf to an empty string when truncating; if Unicode had been output previously, it had been coerced to a Unicode string, potentially making subsequent prints behave differently or raise UnicodeErrors. 2010-08-01 08:22:05 +00:00
Nick Coghlan dfb45dfd04 Issue 7490: make IGNORE_EXCEPTION_DETAIL also ignore details of the module containing the exception under test (original patch by Lennart Regebro) 2010-04-28 14:29:06 +00:00
Victor Stinner edb9f873cf Issue #7449 part 3, test_doctest: import trace module in test_coverage()
Import trace module fail if the threading module is missing. test_coverage() is
only used if test_doctest.py is used with the -c option. This commit allows to
execute the test suite without thread support.

Move "import trace" in test_coverage() and use
test_support.import_module('trace').
2010-04-27 21:51:26 +00:00
Florent Xicluna 6257a7bbb2 Replace catch_warnings with check_warnings when it makes sense. Use assertRaises context manager to simplify some tests. 2010-03-31 22:01:03 +00:00
Florent Xicluna 0762788081 #7092 - Silence more py3k deprecation warnings, using test_support.check_py3k_warnings() helper. 2010-03-21 01:14:24 +00:00
Florent Xicluna 2a903b26e9 Issue #1729305: Fix doctest to handle encode error with "backslashreplace". It fixes #7667 too. 2010-02-27 13:31:23 +00:00
Benjamin Peterson d7b0eebcae split unittest.py into a package 2009-07-19 20:18:21 +00:00
Amaury Forgeot d'Arc f81ff989d6 #6227: Because of a wrong indentation, the test was not testing what it should.
Ensure that the snippet in doctest_aliases actually contains aliases.
2009-06-14 21:20:40 +00:00
Nick Coghlan a2053475bb Fix several issues relating to access to source code inside zipfiles. Initial work by Alexander Belopolsky. See Misc/NEWS in this checkin for details. 2008-12-14 10:54:50 +00:00
Christian Heimes c5f05e45cf Patch #2167 from calvin: Remove unused imports 2008-02-23 17:40:11 +00:00
Raymond Hettinger fff4e6e171 Doctest results return a named tuple for readability 2008-01-11 01:25:54 +00:00
Georg Brandl f725b9587c Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst. 2008-01-05 19:44:22 +00:00
Christian Heimes c756d00cf2 Replaced import of the 'new' module with 'types' module and added a deprecation warning to the 'new' module. 2007-11-27 21:34:01 +00:00
Brett Cannon eaa2c980ee Fix a bug in the test for using __loader__.get_data(). 2007-11-23 00:06:51 +00:00
Brett Cannon 9db1d5a379 Add a missing check before deleting a package's __loader__. 2007-11-21 00:58:03 +00:00
Brett Cannon 43e53f85b6 doctest assumed that a package's __loader__.get_data() method used universal
newlines; it doesn't.  To rectify this the string returned replaces all
instances of os.linesep with '\n' to fake universal newline support.

Backport candidate.
2007-11-21 00:47:36 +00:00
Brett Cannon 0e5edf5afd Remove a unneeded line that had typos. 2007-11-21 00:16:20 +00:00
Tim Peters 6f6814706e Bug #1529297: The rewrite of doctest for Python 2.4 unintentionally
lost that tests are sorted by name before being run.  ``DocTestFinder``
has been changed to sort the list of tests it returns.
2006-07-27 23:44:37 +00:00
Tim Peters bf0400abe9 Remove doctest.testmod's deprecated (in 2.4) `isprivate`
argument.  A lot of hair went into supporting that!
2006-06-05 01:43:03 +00:00
George Yoshida f3c65de460 Patch #1080727: add "encoding" parameter to doctest.DocFileSuite
Contributed by Bjorn Tillenius.
2006-05-28 16:39:09 +00:00
Tim Peters ad2ef33245 Variant of patch #1478292. doctest.register_optionflag(name)
shouldn't create a new flag when `name` is already the name of
an option flag.
2006-05-10 02:43:01 +00:00
Tim Peters 711bf30b89 Patch #1475231: add a new SKIP doctest option, thanks to
Edward Loper.
2006-04-25 03:31:36 +00:00
Tim Peters 1c5bc1c9d7 Part of bug 1459808: fiddle so that this passes
with or without -Qnew.
2006-03-28 07:28:40 +00:00
Jeremy Hylton 3e0055f8c6 Merge ast-branch to head
This change implements a new bytecode compiler, based on a
transformation of the parse tree to an abstract syntax defined in
Parser/Python.asdl.

The compiler implementation is not complete, but it is in stable
enough shape to run the entire test suite excepting two disabled
tests.
2005-10-20 19:59:25 +00:00
Georg Brandl ecf93c765c Fix test cases for doctest. 2005-06-26 23:09:51 +00:00
Fred Drake 7c404a4bf7 add __file__ to the globals available for tests loaded via DocFileSuite;
this is useful for locating supporting data files, just as it is in Python
modules
2004-12-21 23:46:34 +00:00
Tim Peters 50c6bdb1d6 test_doctest.py test_pdb_set_trace_nested(): A new test from Jim Fulton
showing that doctest's pdb.set_trace() support was dramatically broken.

doctest.py _OutputRedirectingPdb.trace_dispatch():  Return a local trace
function instead of (implicitly) None.  Else interaction with pdb was
bizarre, noticing only 'call' events.  Amazingly, the existing set_trace()
tests didn't care.
2004-11-08 22:07:37 +00:00
Edward Loper 7d88a58e85 Reverted the addition of a NORMALIZE_NUMBERS option, per Tim Peter's
request.  Tim says that "correct 'fuzzy' comparison of floats cannot
be automated."  (The motivation behind adding the new option
was verifying interactive examples in Python's latex documentation;
several such examples use numbers that don't print consistently on
different platforms.)
2004-09-28 05:50:57 +00:00
Edward Loper aec3c9b54f Added a new NORMALIZE_NUMBERS option, which causes number literals in
the expected output to match corresponding number literals in the
actual output if their values are equal (to ten digits of precision).
2004-09-28 04:29:57 +00:00
Edward Loper 4ae900f43b - Changed SampleClass docstrings to test docstring parsing a little
more thouroughly.
2004-09-21 03:20:34 +00:00
Edward Loper 052d0cd291 - Added "testfile" function, a simple function for running & verifying
all examples in a given text file. (analagous to "testmod")
- Minor docstring fixes.
- Added module_relative parameter to DocTestFile/DocTestSuite, which
  controls whether paths are module-relative & os-independent, or
  os-specific.
2004-09-19 17:19:33 +00:00
Edward Loper 0273f5b6b2 In DocFileTest:
- Fixed bug in handling of absolute paths.
  - If run from an interactive session, make paths relative to the
    directory containing sys.argv[0] (since __main__ doesn't have
    a __file__ attribute).
2004-09-18 20:27:04 +00:00
Tim Peters 958cc89037 exclude_empty: make the default True for DocTestFinder, and introduce it
with default False for testmod().  The real point of introducing this was
so that output from doctest.master.summarize() would be the same as in
2.3, and doctest.master in 2.4 is a backward-compatability hack used only
by testmod().
2004-09-13 14:53:28 +00:00
Edward Loper 32ddbf7fab Added new parameter exclude_empty to DocTestFinder.__init__, which
controls whether tests are included for objects with empty docstrings.
Defaults to True, to match the behavior of Python 2.3.
2004-09-13 05:47:24 +00:00
Tim Peters c56847878e DocTestFinder._find(): for tests derived from a module __test__ global,
doctest always promised to stick "__test__" in the name.  That got
broken.  Now it's fixed again.
2004-09-13 01:07:12 +00:00
Tim Peters 17b56379e1 Recover from inspect.getmodule() changes. It returns a module for
functions and methods now, including functions defined inside doctests
in test_doctest.py's recursive doctest'ing.
2004-09-11 17:33:27 +00:00
Tim Peters 1fbf9c5ec1 Added IGNORE_EXCEPTION_DETAIL comparison option. The need is explained
in the new docs.

DocTestRunner.__run:  Separate the determination of the example outcome
from reporting that outcome, to squash brittle code duplication and
excessive nesting.
2004-09-04 17:21:02 +00:00
Tim Peters df7a208ff7 Whitespace normalization. 2004-08-29 00:38:17 +00:00
Jim Fulton f54bad4564 - setUp and tearDown functions are now passed the test object
- Added a set_unittest_reportflags to set default reporting flags used
  when running doctests under unittest control.
2004-08-28 14:57:56 +00:00
Edward Loper 0fafacc672 Removed outdated comment 2004-08-27 14:56:58 +00:00
Edward Loper 2de91ba2ab - Removed redundant call to expandtabs in DocTestParesr.
- Improvements to interactive debugging support:
  - Changed the replacement pdb.set_trace to redirect stdout to the
    real stdout *only* during interactive debugging; stdout from code
    continues to go to the fake stdout.
  - When the interactive debugger gets to the end of an example,
    automatically continue.
  - Use a replacement linecache.getlines that will return source lines
    from doctest examples; this makes the source available to the
    debugger for interactive debugging.
- In test_doctest, use a specialized _FakeOutput class instead of a
  temporary file to fake stdin for the interactive interpreter.
2004-08-27 02:07:46 +00:00
Edward Loper 00f8da77e7 - Added DocTestParser.parse(), which parses a docstring into Examples
and intervening text strings.
- Removed DocTestParser.get_program(): use script_from_examples()
  instead.
- Fixed bug in DocTestParser._INDENT_RE
- Fixed bug in DocTestParser._min_indent
- Moved _want_comment() to the utility function section
2004-08-26 18:05:07 +00:00
Tim Peters e7edcb8e22 output_difference(): In fancy-diff cases, the way this split expected &
actual output into lines created spurious empty lines at the ends of
each.  Those matched, but the fancy diffs had surprising line counts (1
larger than expected), and tests kept having to slam <BLANKLINE> into the
expected output to account for this.  Using the splitlines() string method
with keepends=True instead accomplishes what was intended directly.
2004-08-26 05:44:27 +00:00
Edward Loper a89f88d53f Added REPORT_ONLY_FIRST_FAILURE flag, which supresses output after the
first failing example in each test.
2004-08-26 02:45:51 +00:00
Edward Loper 71f55af826 Renamed UNIFIED_DIFF->REPORT_UDIFF; CONTEXT_DIFF->REPORT_CDIFF; and
NDIFF_DIFF->REPORT_NDIFF.  This establishes the naming convention that
all reporting options should begin with "REPORT_" (since reporting
options are a different class from output comparison options; but they
are both set in optionflags).
2004-08-26 01:41:51 +00:00
Edward Loper 5662929a42 Shortened diff output for unified & context diffs 2004-08-26 01:31:56 +00:00