This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Arfrever
Recipients Arfrever, larry, ncoghlan, pitrou, python-dev, rbcollins, serhiy.storchaka
Date 2015-09-20.05:10:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1442725809.36.0.815686014878.issue25108@psf.upfronthosting.co.za>
In-reply-to
Content
> New changeset f6125114b55f by Serhiy Storchaka in branch '2.7':
> Issue #25108: Backported tests for traceback functions print_stack(),
> https://hg.python.org/cpython/rev/f6125114b55f

The new tests fail on 2.7 branch when Lib/test/test_traceback.pyc is present, because __file__ can contain path to *.pyc files in Python 2.
It is sufficient to run test_traceback twice to reproduce problem:

$ LD_LIBRARY_PATH="$(pwd)" ./python -m test.regrtest -v test_traceback
...
$ LD_LIBRARY_PATH="$(pwd)" ./python -m test.regrtest -v test_traceback
== CPython 2.7.10+ (2.7:fe84898fbe98, Sep 20 2015, 06:52:14) [GCC 4.9.3]
==   Linux-4.1.7 little-endian
==   /tmp/cpython/build/test_python_24845
Testing with flags: sys.flags(debug=0, py3k_warning=0, division_warning=0, division_new=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, tabcheck=0, verbose=0, unicode=0, bytes_warning=0, hash_randomization=0)
[1/1] test_traceback
test_bad_indentation (test.test_traceback.TracebackCases) ... ok
test_base_exception (test.test_traceback.TracebackCases) ... ok
test_bug737473 (test.test_traceback.TracebackCases) ... ok
test_caret (test.test_traceback.TracebackCases) ... ok
test_format_exception_only_bad__str__ (test.test_traceback.TracebackCases) ... ok
test_nocaret (test.test_traceback.TracebackCases) ... ok
test_string_exception1 (test.test_traceback.TracebackCases) ... ok
test_string_exception2 (test.test_traceback.TracebackCases) ... ok
test_unicode (test.test_traceback.TracebackCases) ... ok
test_without_exception (test.test_traceback.TracebackCases) ... ok
test_format_stack (test.test_traceback.TracebackFormatTests) ... FAIL
test_print_stack (test.test_traceback.TracebackFormatTests) ... FAIL
test_traceback_format (test.test_traceback.TracebackFormatTests) ... ok
test_extract_stack (test.test_traceback.MiscTracebackCases) ... FAIL

======================================================================
FAIL: test_format_stack (test.test_traceback.TracebackFormatTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/cpython/Lib/test/test_traceback.py", line 232, in test_format_stack
    '    return traceback.format_stack()\n' % (__file__, lineno+1),
AssertionError: Lists differ: ['  File "/tmp/cpython/Lib/tes... != ['  File "/tmp/cpython/Lib/tes...

First differing element 0:
  File "/tmp/cpython/Lib/test/test_traceback.py", line 226, in test_format_stack
    result = fmt()

  File "/tmp/cpython/Lib/test/test_traceback.pyc", line 226, in test_format_stack
    result = fmt()


- ['  File "/tmp/cpython/Lib/test/test_traceback.py", line 226, in test_format_stack\n    result = fmt()\n',
+ ['  File "/tmp/cpython/Lib/test/test_traceback.pyc", line 226, in test_format_stack\n    result = fmt()\n',
?                                                  +

-  '  File "/tmp/cpython/Lib/test/test_traceback.py", line 225, in fmt\n    return traceback.format_stack()\n']
+  '  File "/tmp/cpython/Lib/test/test_traceback.pyc", line 225, in fmt\n    return traceback.format_stack()\n']
?                                                  +


======================================================================
FAIL: test_print_stack (test.test_traceback.TracebackFormatTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/cpython/Lib/test/test_traceback.py", line 220, in test_print_stack
    '    traceback.print_stack()',
AssertionError: Lists differ: ['  File "/tmp/cpython/Lib/tes... != ['  File "/tmp/cpython/Lib/tes...

First differing element 0:
  File "/tmp/cpython/Lib/test/test_traceback.py", line 214, in test_print_stack
  File "/tmp/cpython/Lib/test/test_traceback.pyc", line 214, in test_print_stack

- ['  File "/tmp/cpython/Lib/test/test_traceback.py", line 214, in test_print_stack',
+ ['  File "/tmp/cpython/Lib/test/test_traceback.pyc", line 214, in test_print_stack',
?                                                  +

   '    prn()',
-  '  File "/tmp/cpython/Lib/test/test_traceback.py", line 212, in prn',
+  '  File "/tmp/cpython/Lib/test/test_traceback.pyc", line 212, in prn',
?                                                  +

   '    traceback.print_stack()']

======================================================================
FAIL: test_extract_stack (test.test_traceback.MiscTracebackCases)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/cpython/Lib/test/test_traceback.py", line 248, in test_extract_stack
    (__file__, lineno+1, 'extract', 'return traceback.extract_stack()'),
AssertionError: Lists differ: [('/tmp/cpython/Lib/test/test_... != [('/tmp/cpython/Lib/test/test_...

First differing element 0:
('/tmp/cpython/Lib/test/test_traceback.py', 244, 'test_extract_stack', 'result = extract()')
('/tmp/cpython/Lib/test/test_traceback.pyc', 244, 'test_extract_stack', 'result = extract()')

- [('/tmp/cpython/Lib/test/test_traceback.py',
+ [('/tmp/cpython/Lib/test/test_traceback.pyc',
?                                           +

    244,
    'test_extract_stack',
    'result = extract()'),
-  ('/tmp/cpython/Lib/test/test_traceback.py',
+  ('/tmp/cpython/Lib/test/test_traceback.pyc',
?                                           +

    243,
    'extract',
    'return traceback.extract_stack()')]

----------------------------------------------------------------------
Ran 14 tests in 4.029s

FAILED (failures=3)
test test_traceback failed -- multiple errors occurred
1 test failed:
    test_traceback
History
Date User Action Args
2015-09-20 05:10:09Arfreversetrecipients: + Arfrever, ncoghlan, pitrou, larry, rbcollins, python-dev, serhiy.storchaka
2015-09-20 05:10:09Arfreversetmessageid: <1442725809.36.0.815686014878.issue25108@psf.upfronthosting.co.za>
2015-09-20 05:10:09Arfreverlinkissue25108 messages
2015-09-20 05:10:08Arfrevercreate