gh-127873: Only check sys.flags.ignore_environment for PYTHON* env vars (#127877)

This commit is contained in:
Hugo van Kemenade 2025-01-21 18:10:08 +02:00 committed by GitHub
parent 13475e0a5a
commit 05d12eecbd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 94 additions and 65 deletions

View file

@ -4,10 +4,10 @@
from test import support
import unittest
import test.test_unittest
from test.support import force_not_colorized
from test.test_unittest.test_result import BufferedWriter
@support.force_not_colorized_test_class
class Test_TestProgram(unittest.TestCase):
def test_discovery_from_dotted_path(self):
@ -121,7 +121,6 @@ def run(self, test):
self.assertEqual(['test.test_unittest', 'test.test_unittest2'],
program.testNames)
@force_not_colorized
def test_NonExit(self):
stream = BufferedWriter()
program = unittest.main(exit=False,
@ -137,7 +136,6 @@ def test_NonExit(self):
'expected failures=1, unexpected successes=1)\n')
self.assertEndsWith(out, expected)
@force_not_colorized
def test_Exit(self):
stream = BufferedWriter()
with self.assertRaises(SystemExit) as cm:
@ -155,7 +153,6 @@ def test_Exit(self):
'expected failures=1, unexpected successes=1)\n')
self.assertEndsWith(out, expected)
@force_not_colorized
def test_ExitAsDefault(self):
stream = BufferedWriter()
with self.assertRaises(SystemExit):
@ -171,7 +168,6 @@ def test_ExitAsDefault(self):
'expected failures=1, unexpected successes=1)\n')
self.assertEndsWith(out, expected)
@force_not_colorized
def test_ExitSkippedSuite(self):
stream = BufferedWriter()
with self.assertRaises(SystemExit) as cm:
@ -184,7 +180,6 @@ def test_ExitSkippedSuite(self):
expected = '\n\nOK (skipped=1)\n'
self.assertEndsWith(out, expected)
@force_not_colorized
def test_ExitEmptySuite(self):
stream = BufferedWriter()
with self.assertRaises(SystemExit) as cm: