[New-bugs-announce] [issue42906] python3 -m doctest test.py tests the stdlib "time" module instead
Stijn van Drongelen
report at bugs.python.org
Tue Jan 12 05:39:42 EST 2021
New submission from Stijn van Drongelen <stijnvandrongelen at gmail.com>:
I have two files, named time.py and time_.py, with the same contents:
def foo():
"""Returns 1.
>>> foo()
1
"""
return 1
When I run
python3 -m doctest -v time_.py
I see the expected behaviour:
Trying:
foo()
Expecting:
1
ok
1 items had no tests:
time_
1 items passed all tests:
1 tests in time_.foo
1 tests in 2 items.
1 passed and 0 failed.
Test passed.
However, when I run
python3 -m doctest -v time_.py
it seems like doctest is testing the standard library 'time' module, while I expected it to have similar output as seen above:
30 items had no tests:
time
time.asctime
(... skipped 24 lines for the bug report ...)
time.time_ns
time.tzset
0 tests in 30 items.
0 passed and 0 failed.
Test passed.
The same happens when I provide a path with slashes in it.
----------
components: Library (Lib)
messages: 384913
nosy: stijnvandrongelen
priority: normal
severity: normal
status: open
title: python3 -m doctest test.py tests the stdlib "time" module instead
type: behavior
versions: Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42906>
_______________________________________
More information about the New-bugs-announce
mailing list