Skip to content

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented Sep 1, 2023

Running test_fcntl logs two "struct.pack: ..." lines because multiprocessing imports test_fcntl twice with
test.support.verbose=1. Move get_lockdata() inside TestFcntl test case and only call it where it's needed, to stop logging these lines.

Running test_fcntl logs two "struct.pack: ..." lines because
multiprocessing imports test_fcntl twice with
test.support.verbose=1. Move get_lockdata() inside TestFcntl test
case and only call it where it's needed, to stop logging these lines.
@vstinner vstinner merged commit 23f54c1 into python:main Sep 1, 2023
@vstinner vstinner deleted the test_fcntl_quiet branch September 1, 2023 12:59
@miss-islington
Copy link
Contributor

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-108760 is a backport of this pull request to the 3.12 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 1, 2023
Running test_fcntl logs two "struct.pack: ..." lines because
multiprocessing imports test_fcntl twice with
test.support.verbose=1. Move get_lockdata() inside TestFcntl test
case and only call it where it's needed, to stop logging these lines.
(cherry picked from commit 23f54c1)

Co-authored-by: Victor Stinner <[email protected]>
@bedevere-bot bedevere-bot removed the needs backport to 3.12 only security fixes label Sep 1, 2023
@vstinner
Copy link
Member Author

vstinner commented Sep 1, 2023

Before:

$ ./python -m test test_fcntl
0:00:00 load avg: 0.97 Run tests sequentially
0:00:00 load avg: 0.97 [1/1] test_fcntl
struct.pack:  b'\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
struct.pack:  b'\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'

== Tests result: SUCCESS ==

1 test OK.

Total duration: 954 ms
Tests result: SUCCESS

After:

$ ./python -m test test_fcntl
0:00:00 load avg: 1.05 Run tests sequentially
0:00:00 load avg: 1.05 [1/1] test_fcntl

== Tests result: SUCCESS ==

1 test OK.

Total duration: 778 ms
Tests result: SUCCESS

The two struct.pack: b'\x01\x00(...)' lines are gone.

Yhg1s pushed a commit that referenced this pull request Sep 1, 2023
Make test_fcntl quiet (GH-108758)

Running test_fcntl logs two "struct.pack: ..." lines because
multiprocessing imports test_fcntl twice with
test.support.verbose=1. Move get_lockdata() inside TestFcntl test
case and only call it where it's needed, to stop logging these lines.
(cherry picked from commit 23f54c1)

Co-authored-by: Victor Stinner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip issue skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants