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.

classification
Title: Failed separate test_from_tuple in test_decimal
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.8, Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: facundobatista, mark.dickinson, rhettinger, serhiy.storchaka, skrah
Priority: normal Keywords: patch

Created on 2018-06-03 12:44 by serhiy.storchaka, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 7355 merged skrah, 2018-06-03 16:00
PR 7356 merged miss-islington, 2018-06-03 16:45
PR 7357 merged miss-islington, 2018-06-03 16:46
Messages (10)
msg318542 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-06-03 12:44
$ ./python -m test -v -m test_from_tuple test_decimal
...
test_from_tuple (test.test_decimal.CWhitebox) ... FAIL

======================================================================
FAIL: test_from_tuple (test.test_decimal.CWhitebox)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/serhiy/py/cpython/Lib/test/test_decimal.py", line 5413, in test_from_tuple
    self.assertEqual(str(c.create_decimal(x)), '-0E-1000026')
AssertionError: '-0E-1000007' != '-0E-1000026'
- -0E-1000007
?          ^^
+ -0E-1000026
?          ^^


----------------------------------------------------------------------
msg318546 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2018-06-03 12:59
I think the tests are order-dependent in multiple places.  Personally, I don't see much value in fixing that because it has little effect on the actual code.
msg318548 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-06-03 13:28
Doesn't this mean that the test is incorrect? It expects the result be '-0E-1000026', but actually it should be '-0E-1000007', and it is '-0E-1000026' only after performing some actions outside of the test. Or maybe that there is a leak of the state out of localcontext?
msg318549 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2018-06-03 13:39
The test is insignificant. The real tests are mpdecimal-testit- 2.4.1.tar.gz (http://www.bytereef.org/mpdecimal/download.html), deccheck.py and my private python test suite.

This test uses the global context that has been modified somewhere. I think I added that test to increase code coverage.
msg318566 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2018-06-03 16:06
The thread local context was modified in test_round(), so prec=28 was used in test_from_tuple() when running the whole test suite but prec=9 when running the single test.

I don't really consider that a bug, but it is easy to "fix".

I wouldn't be surprised if other similar cases exist.
msg318570 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-06-03 16:29
I ran all tests separately and this was the only case. PR 7355 fixes it. There are no other failures, errors or warnings.

    ./python -m test -uall --list-cases test_decimal | xargs -n1 -I '{}' ./python -We -m test -vuall -m '{}' test_decimal
msg318572 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2018-06-03 16:40
New changeset e95dfc5006d19e59c7871faa9973356844ddb3ae by Stefan Krah in branch 'master':
bpo-33750: Reset thread-local context precision in test_round(). (#7355)
https://github.com/python/cpython/commit/e95dfc5006d19e59c7871faa9973356844ddb3ae
msg318573 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2018-06-03 17:30
New changeset 7f1bcda9bc3c04100cb047373732db0eba00e581 by Stefan Krah (Miss Islington (bot)) in branch '3.6':
bpo-33750: Reset thread-local context precision in test_round(). (GH-7355) (#7356)
https://github.com/python/cpython/commit/7f1bcda9bc3c04100cb047373732db0eba00e581
msg318574 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2018-06-03 17:36
New changeset bdab3ea8b98db2133ef1e2d92b2a2c539f08ddaf by Stefan Krah (Miss Islington (bot)) in branch '3.7':
bpo-33750: Reset thread-local context precision in test_round(). (GH-7355) (#7357)
https://github.com/python/cpython/commit/bdab3ea8b98db2133ef1e2d92b2a2c539f08ddaf
msg318575 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2018-06-03 17:39
OK, thanks for checking the other tests!
History
Date User Action Args
2022-04-11 14:59:01adminsetgithub: 77931
2018-06-03 17:39:06skrahsetstatus: open -> closed
resolution: fixed
messages: + msg318575

stage: patch review -> resolved
2018-06-03 17:36:36skrahsetmessages: + msg318574
2018-06-03 17:30:14skrahsetmessages: + msg318573
2018-06-03 16:46:59miss-islingtonsetpull_requests: + pull_request6984
2018-06-03 16:45:55miss-islingtonsetpull_requests: + pull_request6983
2018-06-03 16:40:02skrahsetmessages: + msg318572
2018-06-03 16:29:15serhiy.storchakasetmessages: + msg318570
2018-06-03 16:06:23skrahsetmessages: + msg318566
2018-06-03 16:00:35skrahsetkeywords: + patch
stage: patch review
pull_requests: + pull_request6982
2018-06-03 13:39:36skrahsetmessages: + msg318549
2018-06-03 13:28:12serhiy.storchakasetmessages: + msg318548
2018-06-03 12:59:31skrahsetmessages: + msg318546
2018-06-03 12:44:18serhiy.storchakacreate