test: follow changes in unittest

- rename assertRegexpMatches() to assertRegex() (Python 3.2)
- rename assertRaisesRegexp() to assertRaisesRegex() (Python 3.2)
(fixes #88)
This commit is contained in:
Ralph Lange
2023-11-03 09:14:03 +01:00
parent a133e160ee
commit 7def04dc0e

View File

@@ -80,10 +80,10 @@ class TestSourceSet(unittest.TestCase):
def test_EmptySetupDirsPath(self): def test_EmptySetupDirsPath(self):
del os.environ['SETUP_PATH'] del os.environ['SETUP_PATH']
self.assertRaisesRegexp(NameError, '\(SETUP_PATH\) is empty', cue.source_set, 'test01') self.assertRaisesRegex(NameError, '\(SETUP_PATH\) is empty', cue.source_set, 'test01')
def test_InvalidSetupName(self): def test_InvalidSetupName(self):
self.assertRaisesRegexp(NameError, 'does not exist in SETUP_PATH', cue.source_set, 'xxdoesnotexistxx') self.assertRaisesRegex(NameError, 'does not exist in SETUP_PATH', cue.source_set, 'xxdoesnotexistxx')
def test_ValidSetupName(self): def test_ValidSetupName(self):
capturedOutput = getStringIO() capturedOutput = getStringIO()
@@ -120,7 +120,7 @@ class TestSourceSet(unittest.TestCase):
sys.stdout = capturedOutput sys.stdout = capturedOutput
cue.source_set('test03') cue.source_set('test03')
sys.stdout = sys.__stdout__ sys.stdout = sys.__stdout__
self.assertRegexpMatches(capturedOutput.getvalue(), 'Ignoring already included setup file') self.assertRegex(capturedOutput.getvalue(), 'Ignoring already included setup file')
class TestUpdateReleaseLocal(unittest.TestCase): class TestUpdateReleaseLocal(unittest.TestCase):
@@ -529,7 +529,7 @@ class TestTravisDetectContext(unittest.TestCase):
sys.stdout = capturedOutput sys.stdout = capturedOutput
cue.detect_context() cue.detect_context()
sys.stdout = sys.__stdout__ sys.stdout = sys.__stdout__
self.assertRegexpMatches(capturedOutput.getvalue(), "Variable 'STATIC' not supported anymore") self.assertRegex(capturedOutput.getvalue(), "Variable 'STATIC' not supported anymore")
def test_MisspelledBcfgGetsWarning(self): def test_MisspelledBcfgGetsWarning(self):
os.environ['BCFG'] = 'static-dubug' os.environ['BCFG'] = 'static-dubug'
@@ -537,7 +537,7 @@ class TestTravisDetectContext(unittest.TestCase):
sys.stdout = capturedOutput sys.stdout = capturedOutput
cue.detect_context() cue.detect_context()
sys.stdout = sys.__stdout__ sys.stdout = sys.__stdout__
self.assertRegexpMatches(capturedOutput.getvalue(), "Unrecognized build configuration setting") self.assertRegex(capturedOutput.getvalue(), "Unrecognized build configuration setting")
@unittest.skipIf(ci_service != 'appveyor', 'Run appveyor tests only on appveyor') @unittest.skipIf(ci_service != 'appveyor', 'Run appveyor tests only on appveyor')
@@ -690,7 +690,7 @@ class TestAppveyorDetectContext(unittest.TestCase):
sys.stdout = capturedOutput sys.stdout = capturedOutput
cue.detect_context() cue.detect_context()
sys.stdout = sys.__stdout__ sys.stdout = sys.__stdout__
self.assertRegexpMatches(capturedOutput.getvalue(), "Variable 'STATIC' not supported anymore") self.assertRegex(capturedOutput.getvalue(), "Variable 'STATIC' not supported anymore")
def test_MisspelledConfigurationGetsWarning(self): def test_MisspelledConfigurationGetsWarning(self):
os.environ['CONFIGURATION'] = 'static-dubug' os.environ['CONFIGURATION'] = 'static-dubug'
@@ -698,7 +698,7 @@ class TestAppveyorDetectContext(unittest.TestCase):
sys.stdout = capturedOutput sys.stdout = capturedOutput
cue.detect_context() cue.detect_context()
sys.stdout = sys.__stdout__ sys.stdout = sys.__stdout__
self.assertRegexpMatches(capturedOutput.getvalue(), "Unrecognized build configuration setting") self.assertRegex(capturedOutput.getvalue(), "Unrecognized build configuration setting")
class TestSetupForBuild(unittest.TestCase): class TestSetupForBuild(unittest.TestCase):