mirror of
https://github.com/python/cpython.git
synced 2025-12-11 03:20:01 +00:00
Some checks are pending
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / Ubuntu SSL tests with AWS-LC (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Undefined behavior sanitizer (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
mypy / Run mypy on Lib/_pyrepl (push) Waiting to run
mypy / Run mypy on Lib/test/libregrtest (push) Waiting to run
mypy / Run mypy on Lib/tomllib (push) Waiting to run
mypy / Run mypy on Tools/build (push) Waiting to run
mypy / Run mypy on Tools/cases_generator (push) Waiting to run
mypy / Run mypy on Tools/clinic (push) Waiting to run
mypy / Run mypy on Tools/jit (push) Waiting to run
mypy / Run mypy on Tools/peg_generator (push) Waiting to run
Make the pwd module functions getpwuid(), getpwnam(), and getpwall() thread-safe. These changes apply to scenarios where the GIL is disabled or in subinterpreter use cases.
33 lines
884 B
Python
33 lines
884 B
Python
import unittest
|
|
|
|
from test.support import threading_helper
|
|
from test.support.threading_helper import run_concurrently
|
|
|
|
from test import test_pwd
|
|
|
|
|
|
NTHREADS = 10
|
|
|
|
|
|
@threading_helper.requires_working_threading()
|
|
class TestPwd(unittest.TestCase):
|
|
def setUp(self):
|
|
self.test_pwd = test_pwd.PwdTest()
|
|
|
|
def test_racing_test_values(self):
|
|
# test_pwd.test_values() calls pwd.getpwall() and checks the entries
|
|
run_concurrently(
|
|
worker_func=self.test_pwd.test_values, nthreads=NTHREADS
|
|
)
|
|
|
|
def test_racing_test_values_extended(self):
|
|
# test_pwd.test_values_extended() calls pwd.getpwall(), pwd.getpwnam(),
|
|
# pwd.getpwduid() and checks the entries
|
|
run_concurrently(
|
|
worker_func=self.test_pwd.test_values_extended,
|
|
nthreads=NTHREADS,
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|