summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2022-12-04 12:28:56 (GMT)
committerGitHub <noreply@github.com>2022-12-04 12:28:56 (GMT)
commit76f43fc09af29401cc0cec7710b03e4dbf8a4578 (patch)
tree562adc6639c1487f8d1a27fbdecbd78957dc0390
parentbf26bdf6ac04878fc720e78422991aaedb9808a1 (diff)
downloadcpython-76f43fc09af29401cc0cec7710b03e4dbf8a4578.zip
cpython-76f43fc09af29401cc0cec7710b03e4dbf8a4578.tar.gz
cpython-76f43fc09af29401cc0cec7710b03e4dbf8a4578.tar.bz2
gh-60203: Always pass True/False as boolean arguments in tests (GH-99983)
Unless we explicitly test non-bool values.
-rw-r--r--Lib/test/_test_multiprocessing.py2
-rw-r--r--Lib/test/test_asyncio/test_ssl.py2
-rw-r--r--Lib/test/test_call.py2
-rw-r--r--Lib/test/test_capi/test_misc.py9
-rw-r--r--Lib/test/test_subprocess.py2
5 files changed, 9 insertions, 8 deletions
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
index a66f4f5..2fa75eb 100644
--- a/Lib/test/_test_multiprocessing.py
+++ b/Lib/test/_test_multiprocessing.py
@@ -6042,5 +6042,5 @@ class SemLockTests(unittest.TestCase):
class SemLock(_multiprocessing.SemLock):
pass
name = f'test_semlock_subclass-{os.getpid()}'
- s = SemLock(1, 0, 10, name, 0)
+ s = SemLock(1, 0, 10, name, False)
_multiprocessing.sem_unlink(name)
diff --git a/Lib/test/test_asyncio/test_ssl.py b/Lib/test/test_asyncio/test_ssl.py
index 5de9b7a..aaf3c37 100644
--- a/Lib/test/test_asyncio/test_ssl.py
+++ b/Lib/test/test_asyncio/test_ssl.py
@@ -1689,7 +1689,7 @@ class TestThreadedServer(SocketThread):
def run(self):
try:
with self._sock:
- self._sock.setblocking(0)
+ self._sock.setblocking(False)
self._run()
finally:
self._s1.close()
diff --git a/Lib/test/test_call.py b/Lib/test/test_call.py
index f148b5e..c17528b 100644
--- a/Lib/test/test_call.py
+++ b/Lib/test/test_call.py
@@ -559,7 +559,7 @@ class FastCallTests(unittest.TestCase):
self.kwargs.clear()
gc.collect()
return 0
- x = IntWithDict(dont_inherit=IntWithDict())
+ x = IntWithDict(optimize=IntWithDict())
# We test the argument handling of "compile" here, the compilation
# itself is not relevant. When we pass flags=x below, x.__index__() is
# called, which changes the keywords dict.
diff --git a/Lib/test/test_capi/test_misc.py b/Lib/test/test_capi/test_misc.py
index 1d30ada..06a51aa 100644
--- a/Lib/test/test_capi/test_misc.py
+++ b/Lib/test/test_capi/test_misc.py
@@ -138,8 +138,9 @@ class CAPITest(unittest.TestCase):
class Z(object):
def __len__(self):
return 1
- self.assertRaises(TypeError, _posixsubprocess.fork_exec,
- 1,Z(),3,(1, 2),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23)
+ with self.assertRaisesRegex(TypeError, 'indexing'):
+ _posixsubprocess.fork_exec(
+ 1,Z(),True,(1, 2),5,6,7,8,9,10,11,12,13,14,True,True,17,False,19,20,21,22,False)
# Issue #15736: overflow in _PySequence_BytesToCharpArray()
class Z(object):
def __len__(self):
@@ -147,7 +148,7 @@ class CAPITest(unittest.TestCase):
def __getitem__(self, i):
return b'x'
self.assertRaises(MemoryError, _posixsubprocess.fork_exec,
- 1,Z(),3,(1, 2),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23)
+ 1,Z(),True,(1, 2),5,6,7,8,9,10,11,12,13,14,True,True,17,False,19,20,21,22,False)
@unittest.skipUnless(_posixsubprocess, '_posixsubprocess required for this test.')
def test_subprocess_fork_exec(self):
@@ -157,7 +158,7 @@ class CAPITest(unittest.TestCase):
# Issue #15738: crash in subprocess_fork_exec()
self.assertRaises(TypeError, _posixsubprocess.fork_exec,
- Z(),[b'1'],3,(1, 2),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23)
+ Z(),[b'1'],True,(1, 2),5,6,7,8,9,10,11,12,13,14,True,True,17,False,19,20,21,22,False)
@unittest.skipIf(MISSING_C_DOCSTRINGS,
"Signature information for builtins requires docstrings")
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index 424a4a9..8713c73 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -3209,7 +3209,7 @@ class POSIXProcessTestCase(BaseTestCase):
1, 2, 3, 4,
True, True, 0,
None, None, None, -1,
- None, "no vfork")
+ None, True)
self.assertIn('fds_to_keep', str(c.exception))
finally:
if not gc_enabled: