Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-40275: Use new test.support helper submodules in tests #21151

Merged
merged 3 commits into from
Jun 25, 2020

Conversation

shihai1991
Copy link
Member

@shihai1991 shihai1991 commented Jun 25, 2020

Use test helpers in the following test cases:

  • tests of distutils
  • test_buffer
  • test_compile
  • test_filecmp
  • test_fileinput
  • test_readline
  • test_smtpnet
  • test_structmembers
  • test_tools

https://bugs.python.org/issue40275

* tests of distutils
* test_buffer
* test_compile
* test_filecmp
* test_fileinput
* test_readline
* test_smtpnet
* test_structmembers
* test_tools
@@ -39,7 +41,7 @@ class BaseTests:
# temp file's name.
def writeTmp(self, content, *, mode='w'): # opening in text mode is the default
fd, name = tempfile.mkstemp()
self.addCleanup(support.unlink, name)
self.addCleanup(safe_unlink, name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to use os_helper.unlink here, rather than changing the function name.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.
I use safe_unlink in here's reason is that test_fileinput have import unlink as safe_unlink.
if I import os_helper again, the imports looks like more duplicated~

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's common to import a module and import some symbols of the same module. "Inconsistencies" are common, especially in tests which are old :-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For such PR which basically updates tests to point to new submodules, I prefer to leave the tests unchanged, don't change the coding style in the same PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Also, PR which only changes coding style are usually rejected. In short, the coding style cannot be updated in Python code base :-))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Also, PR which only changes coding style are usually rejected. In short, the coding style cannot be updated in Python code base :-))

Got it, Thanks. I have know the pain of code churn( not easy for finding the historical record ;-) )

@vstinner vstinner merged commit 847f94f into python:master Jun 25, 2020
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 RHEL7 3.x has failed when building commit 847f94f.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/4/builds/1161) and take a look at the build logs.
  4. Check if the failure is related to this commit (847f94f) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/4/builds/1161

Failed tests:

  • test_asyncio

Summary of the results of the build (if available):

==

Click to see traceback logs
remote: Enumerating objects: 53, done.        
remote: Counting objects:   1% (1/53)        
remote: Counting objects:   3% (2/53)        
remote: Counting objects:   5% (3/53)        
remote: Counting objects:   7% (4/53)        
remote: Counting objects:   9% (5/53)        
remote: Counting objects:  11% (6/53)        
remote: Counting objects:  13% (7/53)        
remote: Counting objects:  15% (8/53)        
remote: Counting objects:  16% (9/53)        
remote: Counting objects:  18% (10/53)        
remote: Counting objects:  20% (11/53)        
remote: Counting objects:  22% (12/53)        
remote: Counting objects:  24% (13/53)        
remote: Counting objects:  26% (14/53)        
remote: Counting objects:  28% (15/53)        
remote: Counting objects:  30% (16/53)        
remote: Counting objects:  32% (17/53)        
remote: Counting objects:  33% (18/53)        
remote: Counting objects:  35% (19/53)        
remote: Counting objects:  37% (20/53)        
remote: Counting objects:  39% (21/53)        
remote: Counting objects:  41% (22/53)        
remote: Counting objects:  43% (23/53)        
remote: Counting objects:  45% (24/53)        
remote: Counting objects:  47% (25/53)        
remote: Counting objects:  49% (26/53)        
remote: Counting objects:  50% (27/53)        
remote: Counting objects:  52% (28/53)        
remote: Counting objects:  54% (29/53)        
remote: Counting objects:  56% (30/53)        
remote: Counting objects:  58% (31/53)        
remote: Counting objects:  60% (32/53)        
remote: Counting objects:  62% (33/53)        
remote: Counting objects:  64% (34/53)        
remote: Counting objects:  66% (35/53)        
remote: Counting objects:  67% (36/53)        
remote: Counting objects:  69% (37/53)        
remote: Counting objects:  71% (38/53)        
remote: Counting objects:  73% (39/53)        
remote: Counting objects:  75% (40/53)        
remote: Counting objects:  77% (41/53)        
remote: Counting objects:  79% (42/53)        
remote: Counting objects:  81% (43/53)        
remote: Counting objects:  83% (44/53)        
remote: Counting objects:  84% (45/53)        
remote: Counting objects:  86% (46/53)        
remote: Counting objects:  88% (47/53)        
remote: Counting objects:  90% (48/53)        
remote: Counting objects:  92% (49/53)        
remote: Counting objects:  94% (50/53)        
remote: Counting objects:  96% (51/53)        
remote: Counting objects:  98% (52/53)        
remote: Counting objects: 100% (53/53)        
remote: Counting objects: 100% (53/53), done.        
remote: Compressing objects: 100% (1/1)        
remote: Compressing objects: 100% (1/1), done.        
remote: Total 27 (delta 26), reused 27 (delta 26), pack-reused 0        
From https://github.com/python/cpython
 * branch            master     -> FETCH_HEAD
Reset branch 'master'

test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run
test_winconsoleio skipped -- test only relevant on win32
test_ttk_guionly skipped -- Tk unavailable due to TclError: no display name and no $DISPLAY environment variab [...]
test_msilib skipped -- No module named '_msi'
test_tix skipped -- Tk unavailable due to TclError: no display name and no $DISPLAY environment variab [...]
test_winsound skipped -- No module named 'winsound'
test_winreg skipped -- No module named 'winreg'
test_startfile skipped -- object <module 'os' from '/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/os.py'> has no attribute 'startfile'
test_kqueue skipped -- test works only on BSD
test_flock (__main__.FNTLEINTRTest) ... ok
test_lockf (__main__.FNTLEINTRTest) ... ok
test_read (__main__.OSEINTRTest) ... ok
test_wait (__main__.OSEINTRTest) ... ok
test_wait3 (__main__.OSEINTRTest) ... ok
test_wait4 (__main__.OSEINTRTest) ... ok
test_waitpid (__main__.OSEINTRTest) ... ok
test_write (__main__.OSEINTRTest) ... ok
test_devpoll (__main__.SelectEINTRTest) ... skipped 'need select.devpoll'
test_epoll (__main__.SelectEINTRTest) ... ok
test_kqueue (__main__.SelectEINTRTest) ... skipped 'need select.kqueue'
test_poll (__main__.SelectEINTRTest) ... ok
test_select (__main__.SelectEINTRTest) ... ok
test_sigtimedwait (__main__.SignalEINTRTest) ... ok
test_sigwaitinfo (__main__.SignalEINTRTest) ... ok
test_accept (__main__.SocketEINTRTest) ... ok
test_open (__main__.SocketEINTRTest) ... ok
test_os_open (__main__.SocketEINTRTest) ... ok
test_recv (__main__.SocketEINTRTest) ... ok
test_recvmsg (__main__.SocketEINTRTest) ... ok
test_send (__main__.SocketEINTRTest) ... ok
test_sendall (__main__.SocketEINTRTest) ... ok
test_sendmsg (__main__.SocketEINTRTest) ... ok
test_sleep (__main__.TimeEINTRTest) ... ok

----------------------------------------------------------------------
Ran 24 tests in 6.999s

OK (skipped=2)
test_gdb skipped -- Couldn't find gdb on the path
test_ossaudiodev skipped -- [Errno 2] No such file or directory: '/dev/dsp'
test_ioctl skipped -- Unable to open /dev/tty
test_tk skipped -- Tk unavailable due to TclError: no display name and no $DISPLAY environment variab [...]
test_devpoll skipped -- test works only on Solaris OS family
<string>:2: PendingDeprecationWarning: lib2to3 package is deprecated and may not be able to parse Python 3.10+
Timeout (0:15:00)!
Thread 0x00007f5ef8861740 (most recent call first):
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/selectors.py", line 468 in select
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/asyncio/base_events.py", line 1854 in _run_once
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/asyncio/base_events.py", line 596 in run_forever
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/asyncio/base_events.py", line 629 in run_until_complete
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/test_asyncio/test_subprocess.py", line 442 in test_cancel_make_subprocess_transport_exec
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/case.py", line 550 in _callTestMethod
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/case.py", line 593 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/case.py", line 653 in __call__
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/runner.py", line 176 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/support/__init__.py", line 967 in _run_suite
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/support/__init__.py", line 1090 in run_unittest
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/libregrtest/runtest.py", line 211 in _test_module
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/libregrtest/runtest.py", line 236 in _runtest_inner2
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/libregrtest/runtest.py", line 272 in _runtest_inner
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/libregrtest/runtest.py", line 142 in _runtest
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/libregrtest/runtest.py", line 195 in runtest
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/libregrtest/runtest_mp.py", line 80 in run_tests_worker
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/libregrtest/main.py", line 659 in _main
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/libregrtest/main.py", line 639 in main
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/libregrtest/main.py", line 717 in main
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/regrtest.py", line 43 in _main
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/regrtest.py", line 47 in <module>
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/runpy.py", line 87 in _run_code
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/runpy.py", line 197 in _run_module_as_main
Timeout (0:15:00)!
Thread 0x00007f9a2e4aa740 (most recent call first):
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/selectors.py", line 468 in select
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/asyncio/base_events.py", line 1854 in _run_once
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/asyncio/base_events.py", line 596 in run_forever
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/asyncio/base_events.py", line 629 in run_until_complete
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/test_asyncio/test_subprocess.py", line 442 in test_cancel_make_subprocess_transport_exec
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/case.py", line 550 in _callTestMethod
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/case.py", line 593 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/case.py", line 653 in __call__
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/unittest/runner.py", line 176 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/support/__init__.py", line 967 in _run_suite
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/support/__init__.py", line 1090 in run_unittest
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/libregrtest/runtest.py", line 211 in _test_module
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/libregrtest/runtest.py", line 236 in _runtest_inner2
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/libregrtest/runtest.py", line 272 in _runtest_inner
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/libregrtest/runtest.py", line 155 in _runtest
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/libregrtest/runtest.py", line 195 in runtest
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/libregrtest/main.py", line 319 in rerun_failed_tests
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/libregrtest/main.py", line 696 in _main
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/libregrtest/main.py", line 639 in main
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/libregrtest/main.py", line 717 in main
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/__main__.py", line 2 in <module>
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/runpy.py", line 87 in _run_code
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/runpy.py", line 197 in _run_module_as_main
make: *** [buildbottest] Error 1

Cannot open file '/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/test-results.xml' for upload

fasih pushed a commit to fasih/cpython that referenced this pull request Jun 29, 2020
…21151)

Use new test.support helper submodules in tests:

* distutils tests
* test_buffer
* test_compile
* test_filecmp
* test_fileinput
* test_readline
* test_smtpnet
* test_structmembers
* test_tools
arun-mani-j pushed a commit to arun-mani-j/cpython that referenced this pull request Jul 21, 2020
…21151)

Use new test.support helper submodules in tests:

* distutils tests
* test_buffer
* test_compile
* test_filecmp
* test_fileinput
* test_readline
* test_smtpnet
* test_structmembers
* test_tools
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants