|
48 | 48 | from easybuild.tools.config import IGNORE, ERROR |
49 | 49 | from easybuild.tools.multidiff import multidiff |
50 | 50 | from easybuild.tools.py2vs3 import std_urllib |
| 51 | +from easybuild.base import fancylogger |
51 | 52 |
|
52 | 53 |
|
53 | 54 | class FileToolsTest(EnhancedTestCase): |
@@ -1264,16 +1265,22 @@ def test_apply_regex_substitutions(self): |
1264 | 1265 | # Error |
1265 | 1266 | self.assertErrorRegex(EasyBuildError, error_pat, ft.apply_regex_substitutions, testfile, regex_subs_no_match, |
1266 | 1267 | on_missing_match=run.ERROR) |
| 1268 | + |
| 1269 | + fancylogger.logToFile(self.logfile) |
| 1270 | + |
1267 | 1271 | # Warn |
1268 | | - self.mock_stderr(True) |
1269 | 1272 | ft.apply_regex_substitutions(testfile, regex_subs_no_match, on_missing_match=run.WARN) |
1270 | | - self.assertTrue(error_pat in self.get_stderr()) |
1271 | | - self.mock_stderr(False) |
| 1273 | + with open(self.logfile, 'r') as f: |
| 1274 | + logtxt = f.read() |
| 1275 | + self.assertTrue('WARNING ' + error_pat in logtxt) |
| 1276 | + |
1272 | 1277 | # Ignore |
1273 | | - self.mock_stderr(True) |
1274 | 1278 | ft.apply_regex_substitutions(testfile, regex_subs_no_match, on_missing_match=run.IGNORE) |
1275 | | - self.assertFalse(error_pat in self.get_stderr()) |
1276 | | - self.mock_stderr(False) |
| 1279 | + with open(self.logfile, 'r') as f: |
| 1280 | + logtxt = f.read() |
| 1281 | + self.assertTrue('INFO ' + error_pat in logtxt) |
| 1282 | + |
| 1283 | + fancylogger.logToFile(self.logfile, enable=False) |
1277 | 1284 |
|
1278 | 1285 | # clean error on non-existing file |
1279 | 1286 | error_pat = "Failed to patch .*/nosuchfile.txt: .*No such file or directory" |
|
0 commit comments