Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4968)

Delta Between Two Patch Sets: Lib/test/test_pydoc.py

Issue 1559549: ImportError needs attributes for module and file name
Left Patch Set: Created 2 years, 2 months ago
Right Patch Set: Created 1 year, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « Lib/test/test_import.py ('k') | Objects/exceptions.c » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 import os 1 import os
2 import sys 2 import sys
3 import builtins 3 import builtins
4 import difflib 4 import difflib
5 import inspect 5 import inspect
6 import pydoc 6 import pydoc
7 import keyword 7 import keyword
8 import re 8 import re
9 import string 9 import string
10 import test.support 10 import test.support
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 'i_am_not_here.{}'.format(modname)), 389 'i_am_not_here.{}'.format(modname)),
390 ('test.{}'.format(modname), modname), 390 ('test.{}'.format(modname), modname),
391 ) 391 )
392 392
393 sourcefn = os.path.join(TESTFN, modname) + os.extsep + "py" 393 sourcefn = os.path.join(TESTFN, modname) + os.extsep + "py"
394 for importstring, expectedinmsg in testpairs: 394 for importstring, expectedinmsg in testpairs:
395 with open(sourcefn, 'w') as f: 395 with open(sourcefn, 'w') as f:
396 f.write("import {}\n".format(importstring)) 396 f.write("import {}\n".format(importstring))
397 result = run_pydoc(modname, PYTHONPATH=TESTFN).decode("ascii") 397 result = run_pydoc(modname, PYTHONPATH=TESTFN).decode("ascii")
398 expected = badimport_pattern % (modname, expectedinmsg) 398 expected = badimport_pattern % (modname, expectedinmsg)
399 print(importstring)
399 self.assertEqual(expected, result) 400 self.assertEqual(expected, result)
400 401
401 def test_apropos_with_bad_package(self): 402 def test_apropos_with_bad_package(self):
402 # Issue 7425 - pydoc -k failed when bad package on path 403 # Issue 7425 - pydoc -k failed when bad package on path
403 pkgdir = os.path.join(TESTFN, "syntaxerr") 404 pkgdir = os.path.join(TESTFN, "syntaxerr")
404 os.mkdir(pkgdir) 405 os.mkdir(pkgdir)
405 badsyntax = os.path.join(pkgdir, "__init__") + os.extsep + "py" 406 badsyntax = os.path.join(pkgdir, "__init__") + os.extsep + "py"
406 with open(badsyntax, 'w') as f: 407 with open(badsyntax, 'w') as f:
407 f.write("invalid python syntax = $1\n") 408 f.write("invalid python syntax = $1\n")
408 result = run_pydoc('zqwykjv', '-k', PYTHONPATH=TESTFN) 409 result = run_pydoc('zqwykjv', '-k', PYTHONPATH=TESTFN)
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 520
520 521
521 class TestHelper(unittest.TestCase): 522 class TestHelper(unittest.TestCase):
522 def test_keywords(self): 523 def test_keywords(self):
523 self.assertEqual(sorted(pydoc.Helper.keywords), 524 self.assertEqual(sorted(pydoc.Helper.keywords),
524 sorted(keyword.kwlist)) 525 sorted(keyword.kwlist))
525 526
526 @reap_threads 527 @reap_threads
527 def test_main(): 528 def test_main():
528 try: 529 try:
529 test.support.run_unittest(PydocDocTest, 530 test.support.run_unittest(#PydocDocTest,
530 PydocImportTest, 531 PydocImportTest,
531 TestDescriptions, 532 #TestDescriptions,
532 PydocServerTest, 533 #PydocServerTest,
533 PydocUrlHandlerTest, 534 #PydocUrlHandlerTest,
534 TestHelper, 535 #TestHelper,
535 ) 536 )
536 finally: 537 finally:
537 reap_children() 538 reap_children()
538 539
539 if __name__ == "__main__": 540 if __name__ == "__main__":
540 test_main() 541 test_main()
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7