Skip to content

Commit

Permalink
test: follow changes in unittest
Browse files Browse the repository at this point in the history
- rename assertRegexpMatches() to assertRegex() (Python 3.2)
- rename assertRaisesRegexp() to assertRaisesRegex() (Python 3.2)
(fixes #88)
  • Loading branch information
ralphlange committed Nov 3, 2023
1 parent a133e16 commit 7def04d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cue-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ def setUp(self):

def test_EmptySetupDirsPath(self):
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):
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):
capturedOutput = getStringIO()
Expand Down Expand Up @@ -120,7 +120,7 @@ def test_DoubleIncludeGetsIgnored(self):
sys.stdout = capturedOutput
cue.source_set('test03')
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):
Expand Down Expand Up @@ -529,15 +529,15 @@ def test_StaticGetsWarning(self):
sys.stdout = capturedOutput
cue.detect_context()
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):
os.environ['BCFG'] = 'static-dubug'
capturedOutput = getStringIO()
sys.stdout = capturedOutput
cue.detect_context()
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')
Expand Down Expand Up @@ -690,15 +690,15 @@ def test_StaticGetsWarning(self):
sys.stdout = capturedOutput
cue.detect_context()
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):
os.environ['CONFIGURATION'] = 'static-dubug'
capturedOutput = getStringIO()
sys.stdout = capturedOutput
cue.detect_context()
sys.stdout = sys.__stdout__
self.assertRegexpMatches(capturedOutput.getvalue(), "Unrecognized build configuration setting")
self.assertRegex(capturedOutput.getvalue(), "Unrecognized build configuration setting")


class TestSetupForBuild(unittest.TestCase):
Expand Down

0 comments on commit 7def04d

Please sign in to comment.