[issue40058] Running test_datetime twice fails with: module 'datetime' has no attribute '_divide_and_round'

2021-10-01 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Fixed in issue40173.

--
nosy: +serhiy.storchaka
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40058] Running test_datetime twice fails with: module 'datetime' has no attribute '_divide_and_round'

2020-06-26 Thread hai shi


hai shi  added the comment:

> My PR of bpo-40799 fix this issue.
Thanks victor for your work, I closed my PR ;)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40058] Running test_datetime twice fails with: module 'datetime' has no attribute '_divide_and_round'

2020-06-25 Thread STINNER Victor


STINNER Victor  added the comment:

My PR of bpo-40799 fix this issue.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40058] Running test_datetime twice fails with: module 'datetime' has no attribute '_divide_and_round'

2020-05-06 Thread Eric Snow


Eric Snow  added the comment:

FYI, with the following additions in Lib/test/test_datetime.py...

   before = set(sys.modules)
   try:
   pure_tests = import_fresh_module(TESTS, fresh=['datetime', '_strptime'],
 blocked=['_datetime'])
   _pure = set(sys.modules)
   fast_tests = import_fresh_module(TESTS, fresh=['datetime',
  '_datetime', '_strptime'])
   _fast = set(sys.modules)
   print(f'added (pure): {sorted(_pure-before)}')
   print(f'added (fast): {sorted(_fast-before)}')
   print('---')
   finally:
  ...

I get the following output running "./python -m test test_datetime 
test_datetime":

   0:00:00 load avg: 0.52 Run tests sequentially
   0:00:00 load avg: 0.52 [1/2] test_datetime
   added (pure): ['_decimal', '_strptime', '_testcapi', 'decimal', 'numbers', 
'test.datetimetester']
   added (fast): ['_decimal', '_strptime', '_testcapi', 'decimal', 'numbers', 
'test.datetimetester']
   ---
   0:00:05 load avg: 0.52 [2/2] test_datetime
   added (pure): ['_datetime', '_strptime', 'datetime']
   added (fast): ['_datetime', '_strptime', 'datetime']
   ---
   [snipped]

That definitely tells a story. :)  Unfortunately, for now I don't have any more 
time to investigate.  Sorry.

--
nosy: +eric.snow

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40058] Running test_datetime twice fails with: module 'datetime' has no attribute '_divide_and_round'

2020-03-29 Thread hai shi


hai shi  added the comment:

> I believe it's a known problem with either `import_fresh_module` or `datetime`
after removed the cleanup operation of `sys.modules` in PR19213, the  testcases 
is successed in my local vm(I am not sure there have any other potential risks).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40058] Running test_datetime twice fails with: module 'datetime' has no attribute '_divide_and_round'

2020-03-29 Thread hai shi


Change by hai shi :


--
keywords: +patch
pull_requests: +18576
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/19213

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40058] Running test_datetime twice fails with: module 'datetime' has no attribute '_divide_and_round'

2020-03-25 Thread Georg Brandl


Georg Brandl  added the comment:

Sorry, it seems that was far too long ago for me to remember anything :)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40058] Running test_datetime twice fails with: module 'datetime' has no attribute '_divide_and_round'

2020-03-25 Thread Paul Ganssle


Paul Ganssle  added the comment:

This isn't exactly "working as intended", but I believe it's a known problem 
with either `import_fresh_module` or `datetime`, as you can see from these 
comments: 
https://github.com/python/cpython/blob/302e5a8f79514fd84bafbc44b7c97ec636302322/Lib/test/test_datetime.py#L14-L23

Based on the git blame, those TODO comments are from Georg Brandl, so I'm 
adding him to the nosy list in case he has some insight.

--
nosy: +georg.brandl

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40058] Running test_datetime twice fails with: module 'datetime' has no attribute '_divide_and_round'

2020-03-25 Thread hai shi


hai shi  added the comment:

add a pdb point in L11 of test_datetime.py

  8 try:
  9 pure_tests = import_fresh_module(TESTS, fresh=['datetime', 
'_strptime'],
 10  blocked=['_datetime'])
 11 import pdb;pdb.set_trace()
 12  -> fast_tests = import_fresh_module(TESTS, fresh=['datetime',
 13'_datetime', 
'_strptime'])

and run `./python -m test test_datetime test_datetime`:
the first iteration:
(Pdb) pure_tests.datetime_module._divide_and_round

the second iteration(`_datetime` not blocked?):
(Pdb) pure_tests.datetime_module._divide_and_round
*** AttributeError: module 'datetime' has no attribute '_divide_and_round'

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40058] Running test_datetime twice fails with: module 'datetime' has no attribute '_divide_and_round'

2020-03-25 Thread hai shi


hai shi  added the comment:

`_divide_and_round()` would be deleted in 
https://github.com/python/cpython/blob/master/Lib/datetime.py#L2516.

if it's removed L2516 of datetime.py, `test_name_cleanup()` would be 
failed.Looks like it's a planed behavior~

--
nosy: +shihai1991

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40058] Running test_datetime twice fails with: module 'datetime' has no attribute '_divide_and_round'

2020-03-25 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +belopolsky, p-ganssle

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40058] Running test_datetime twice fails with: module 'datetime' has no attribute '_divide_and_round'

2020-03-25 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40058] Running test_datetime twice fails with: module 'datetime' has no attribute '_divide_and_round'

2020-03-24 Thread STINNER Victor


New submission from STINNER Victor :

vstinner@apu$ ./python -m test -v test_datetime test_datetime -m 
test_divide_and_round
== CPython 3.9.0a5+ (heads/pr/19122:0ac3031a80, Mar 25 2020, 02:25:19) [GCC 
9.2.1 20190827 (Red Hat 9.2.1-1)]
== Linux-5.5.9-200.fc31.x86_64-x86_64-with-glibc2.30 little-endian
== cwd: /home/vstinner/python/master/build/test_python_233006
== CPU count: 8
== encodings: locale=UTF-8, FS=utf-8
0:00:00 load avg: 0.82 Run tests sequentially
0:00:00 load avg: 0.82 [1/2] test_datetime
test_divide_and_round (test.datetimetester.TestModule_Pure) ... ok
test_divide_and_round (test.datetimetester.TestModule_Fast) ... skipped 'Only 
run for Pure Python implementation'

--

Ran 2 tests in 0.002s

OK (skipped=1)
0:00:00 load avg: 0.82 [2/2] test_datetime
test_divide_and_round (test.datetimetester.TestModule_Pure) ... ERROR
test_divide_and_round (test.datetimetester.TestModule_Fast) ... skipped 'Only 
run for Pure Python implementation'

==
ERROR: test_divide_and_round (test.datetimetester.TestModule_Pure)
--
Traceback (most recent call last):
  File "/home/vstinner/python/master/Lib/test/datetimetester.py", line 87, in 
test_divide_and_round
dar = datetime_module._divide_and_round
AttributeError: module 'datetime' has no attribute '_divide_and_round'

--

Ran 2 tests in 0.006s

FAILED (errors=1, skipped=1)
test test_datetime failed
test_datetime failed

== Tests result: FAILURE ==

1 test OK.

1 test failed:
test_datetime

Total duration: 448 ms
Tests result: FAILURE

--
components: Tests
messages: 364970
nosy: vstinner
priority: normal
severity: normal
status: open
title: Running test_datetime twice fails with: module 'datetime' has no 
attribute '_divide_and_round'
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com