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

GH-100192: add more asyncio subprocess tests #100194

Merged
merged 5 commits into from
Dec 28, 2022

Conversation

kumaraditya303
Copy link
Contributor

@kumaraditya303 kumaraditya303 commented Dec 12, 2022

Comment on lines 699 to 701
task = asyncio.create_task(proc.wait())
await asyncio.sleep(0)
self.assertEqual(task.result(), proc.returncode)
Copy link
Member

Choose a reason for hiding this comment

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

Why not await task instead of sleep(0) and task.result()? At this point we already know the process has exited, since the returncode is 0 on the previous line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At this point we already know the process has exited, since the returncode is 0 on the previous line.

Yes, awaiting can take more than one cycle but we are checking that wait will be done immediately so using sleep(0) trick.

Lib/test/test_asyncio/test_subprocess.py Outdated Show resolved Hide resolved
Lib/test/test_asyncio/test_subprocess.py Outdated Show resolved Hide resolved
Lib/test/test_asyncio/test_subprocess.py Outdated Show resolved Hide resolved
@kumaraditya303 kumaraditya303 linked an issue Dec 28, 2022 that may be closed by this pull request
@kumaraditya303 kumaraditya303 merged commit e97afef into python:main Dec 28, 2022
@kumaraditya303 kumaraditya303 deleted the subprocess-tests branch December 28, 2022 04:12
@bedevere-bot
Copy link

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

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

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/15/builds/3671) and take a look at the build logs.
  4. Check if the failure is related to this commit (e97afef) 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/15/builds/3671

Failed tests:

  • test_asyncio

Failed subtests:

  • test_create_subprocess_env_exec - test.test_asyncio.test_subprocess.SubprocessThreadedWatcherTests.test_create_subprocess_env_exec
  • test_create_subprocess_env_exec - test.test_asyncio.test_subprocess.SubprocessSafeWatcherTests.test_create_subprocess_env_exec
  • test_create_subprocess_env_shell - test.test_asyncio.test_subprocess.SubprocessFastWatcherTests.test_create_subprocess_env_shell
  • test_create_subprocess_env_shell - test.test_asyncio.test_subprocess.SubprocessSafeWatcherTests.test_create_subprocess_env_shell
  • test_create_subprocess_env_shell - test.test_asyncio.test_subprocess.SubprocessThreadedWatcherTests.test_create_subprocess_env_shell
  • test_create_subprocess_env_exec - test.test_asyncio.test_subprocess.SubprocessFastWatcherTests.test_create_subprocess_env_exec

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

== Tests result: FAILURE then FAILURE ==

409 tests OK.

10 slowest tests:

  • test_concurrent_futures: 2 min 30 sec
  • test_multiprocessing_spawn: 2 min 8 sec
  • test_capi: 1 min 38 sec
  • test_multiprocessing_forkserver: 1 min 26 sec
  • test_multiprocessing_fork: 1 min 8 sec
  • test_asyncio: 1 min 8 sec
  • test_signal: 56.3 sec
  • test_tokenize: 50.3 sec
  • test_socket: 39.4 sec
  • test_io: 38.2 sec

1 test failed:
test_asyncio

23 tests skipped:
test_check_c_globals test_devpoll test_gdb test_idle test_ioctl
test_kqueue test_launcher test_msilib test_peg_generator
test_smtpnet test_ssl test_startfile test_tcl test_tix
test_tkinter test_ttk test_ttk_textonly test_turtle
test_winconsoleio test_winreg test_winsound test_wmi
test_zipfile64

1 re-run test:
test_asyncio

Total duration: 3 min 29 sec

Click to see traceback logs
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/test_asyncio/test_subprocess.py", line 707, in test_create_subprocess_env_shell
    self.loop.run_until_complete(self.check_stdout_output(main(), b'bar'))
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/asyncio/base_events.py", line 664, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/test_asyncio/test_subprocess.py", line 692, in check_stdout_output
    self.assertEqual(stdout, output)
AssertionError: b'' != b'bar'


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/test_asyncio/test_subprocess.py", line 719, in test_create_subprocess_env_exec
    self.loop.run_until_complete(self.check_stdout_output(main(), b'baz'))
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/asyncio/base_events.py", line 664, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64/build/Lib/test/test_asyncio/test_subprocess.py", line 692, in check_stdout_output
    self.assertEqual(stdout, output)
AssertionError: b'' != b'baz'

@kumaraditya303
Copy link
Contributor Author

kumaraditya303 commented Dec 28, 2022

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

Created #100569 to fix this, it failed because the buildbot uses env vars to pass shared library location.

@bedevere-bot
Copy link

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

Hi! The buildbot AMD64 RHEL8 FIPS Only Blake2 Builtin Hash 3.x has failed when building commit e97afef.

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/469/builds/3963) and take a look at the build logs.
  4. Check if the failure is related to this commit (e97afef) 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/469/builds/3963

Failed tests:

  • test_asyncio

Failed subtests:

  • test_create_subprocess_env_exec - test.test_asyncio.test_subprocess.SubprocessThreadedWatcherTests.test_create_subprocess_env_exec
  • test_create_subprocess_env_exec - test.test_asyncio.test_subprocess.SubprocessSafeWatcherTests.test_create_subprocess_env_exec
  • test_create_subprocess_env_shell - test.test_asyncio.test_subprocess.SubprocessFastWatcherTests.test_create_subprocess_env_shell
  • test_create_subprocess_env_shell - test.test_asyncio.test_subprocess.SubprocessSafeWatcherTests.test_create_subprocess_env_shell
  • test_create_subprocess_env_shell - test.test_asyncio.test_subprocess.SubprocessThreadedWatcherTests.test_create_subprocess_env_shell
  • test_create_subprocess_env_exec - test.test_asyncio.test_subprocess.SubprocessFastWatcherTests.test_create_subprocess_env_exec

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

== Tests result: FAILURE then FAILURE ==

416 tests OK.

10 slowest tests:

  • test_gdb: 6 min 55 sec
  • test_concurrent_futures: 2 min 43 sec
  • test_capi: 2 min 1 sec
  • test_asyncio: 1 min 53 sec
  • test_multiprocessing_spawn: 1 min 50 sec
  • test_multiprocessing_forkserver: 1 min 15 sec
  • test_tokenize: 1 min 7 sec
  • test_multiprocessing_fork: 59.2 sec
  • test_signal: 49.4 sec
  • test_socket: 45.6 sec

1 test failed:
test_asyncio

16 tests skipped:
test_check_c_globals test_devpoll test_ioctl test_kqueue
test_launcher test_msilib test_peg_generator test_startfile
test_tix test_tkinter test_ttk test_winconsoleio test_winreg
test_winsound test_wmi test_zipfile64

1 re-run test:
test_asyncio

Total duration: 9 min 54 sec

Click to see traceback logs
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-fips-x86_64.no-builtin-hashes-except-blake2/build/Lib/test/test_asyncio/test_subprocess.py", line 719, in test_create_subprocess_env_exec
    self.loop.run_until_complete(self.check_stdout_output(main(), b'baz'))
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-fips-x86_64.no-builtin-hashes-except-blake2/build/Lib/asyncio/base_events.py", line 664, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-fips-x86_64.no-builtin-hashes-except-blake2/build/Lib/test/test_asyncio/test_subprocess.py", line 692, in check_stdout_output
    self.assertEqual(stdout, output)
AssertionError: b'' != b'baz'


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-fips-x86_64.no-builtin-hashes-except-blake2/build/Lib/test/test_asyncio/test_subprocess.py", line 707, in test_create_subprocess_env_shell
    self.loop.run_until_complete(self.check_stdout_output(main(), b'bar'))
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-fips-x86_64.no-builtin-hashes-except-blake2/build/Lib/asyncio/base_events.py", line 664, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-fips-x86_64.no-builtin-hashes-except-blake2/build/Lib/test/test_asyncio/test_subprocess.py", line 692, in check_stdout_output
    self.assertEqual(stdout, output)
AssertionError: b'' != b'bar'

@bedevere-bot
Copy link

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

Hi! The buildbot AMD64 Ubuntu Shared 3.x has failed when building commit e97afef.

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/506/builds/3853) and take a look at the build logs.
  4. Check if the failure is related to this commit (e97afef) 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/506/builds/3853

Failed tests:

  • test_asyncio

Failed subtests:

  • test_create_subprocess_env_exec - test.test_asyncio.test_subprocess.SubprocessThreadedWatcherTests.test_create_subprocess_env_exec
  • test_create_subprocess_env_exec - test.test_asyncio.test_subprocess.SubprocessSafeWatcherTests.test_create_subprocess_env_exec
  • test_create_subprocess_env_shell - test.test_asyncio.test_subprocess.SubprocessFastWatcherTests.test_create_subprocess_env_shell
  • test_create_subprocess_env_shell - test.test_asyncio.test_subprocess.SubprocessSafeWatcherTests.test_create_subprocess_env_shell
  • test_create_subprocess_env_shell - test.test_asyncio.test_subprocess.SubprocessThreadedWatcherTests.test_create_subprocess_env_shell
  • test_create_subprocess_env_exec - test.test_asyncio.test_subprocess.SubprocessFastWatcherTests.test_create_subprocess_env_exec

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

== Tests result: FAILURE then FAILURE ==

412 tests OK.

10 slowest tests:

  • test_tools: 8 min 37 sec
  • test_multiprocessing_spawn: 4 min 32 sec
  • test_concurrent_futures: 3 min 19 sec
  • test_capi: 3 min 8 sec
  • test_gdb: 2 min 46 sec
  • test_asyncio: 2 min 28 sec
  • test_tokenize: 1 min 49 sec
  • test_multiprocessing_forkserver: 1 min 43 sec
  • test_lib2to3: 1 min 38 sec
  • test_multiprocessing_fork: 1 min 26 sec

1 test failed:
test_asyncio

20 tests skipped:
test_check_c_globals test_devpoll test_idle test_ioctl test_kqueue
test_launcher test_msilib test_peg_generator test_startfile
test_tcl test_tix test_tkinter test_ttk test_ttk_textonly
test_turtle test_winconsoleio test_winreg test_winsound test_wmi
test_zipfile64

1 re-run test:
test_asyncio

Total duration: 34 min 2 sec

Click to see traceback logs
Traceback (most recent call last):
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_asyncio/test_subprocess.py", line 707, in test_create_subprocess_env_shell
    self.loop.run_until_complete(self.check_stdout_output(main(), b'bar'))
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/asyncio/base_events.py", line 664, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_asyncio/test_subprocess.py", line 692, in check_stdout_output
    self.assertEqual(stdout, output)
AssertionError: b'' != b'bar'


Traceback (most recent call last):
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_asyncio/test_subprocess.py", line 719, in test_create_subprocess_env_exec
    self.loop.run_until_complete(self.check_stdout_output(main(), b'baz'))
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/asyncio/base_events.py", line 664, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_asyncio/test_subprocess.py", line 692, in check_stdout_output
    self.assertEqual(stdout, output)
AssertionError: b'' != b'baz'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir topic-asyncio
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add more tests for asyncio subprocess
3 participants