|
39 | 39 | from unittest import TextTestRunner |
40 | 40 |
|
41 | 41 | import easybuild.tools.systemtools as st |
| 42 | +from easybuild.base import fancylogger |
42 | 43 | from easybuild.framework.easyblock import EasyBlock, get_easyblock_instance |
43 | 44 | from easybuild.framework.easyconfig import CUSTOM |
44 | 45 | from easybuild.framework.easyconfig.easyconfig import EasyConfig |
@@ -2424,6 +2425,30 @@ def test_checksum_step(self): |
2424 | 2425 | eb.fetch_sources() |
2425 | 2426 | eb.checksum_step() |
2426 | 2427 |
|
| 2428 | + with self.mocked_stdout_stderr() as (stdout, stderr): |
| 2429 | + |
| 2430 | + # using checksum-less test easyconfig in location that does not provide checksums.json |
| 2431 | + test_ec = os.path.join(self.test_prefix, 'test-no-checksums.eb') |
| 2432 | + copy_file(toy_ec, test_ec) |
| 2433 | + write_file(test_ec, 'checksums = []', append=True) |
| 2434 | + ec = process_easyconfig(test_ec)[0] |
| 2435 | + |
| 2436 | + # enable logging to screen, so we can check whether error is logged when checksums.json is not found |
| 2437 | + fancylogger.logToScreen(enable=True, stdout=True) |
| 2438 | + |
| 2439 | + eb = get_easyblock_instance(ec) |
| 2440 | + eb.fetch_sources() |
| 2441 | + eb.checksum_step() |
| 2442 | + |
| 2443 | + fancylogger.logToScreen(enable=False, stdout=True) |
| 2444 | + stdout = self.get_stdout() |
| 2445 | + |
| 2446 | + # make sure there's no error logged for not finding checksums.json, |
| 2447 | + # see also https://github.com/easybuilders/easybuild-framework/issues/4301 |
| 2448 | + regex = re.compile("ERROR .*Couldn't find file checksums.json anywhere", re.M) |
| 2449 | + regex.search(stdout) |
| 2450 | + self.assertFalse(regex.search(stdout), "Pattern '%s' should not be found in log" % regex.pattern) |
| 2451 | + |
2427 | 2452 | # fiddle with checksum to check whether faulty checksum is catched |
2428 | 2453 | copy_file(toy_ec, self.test_prefix) |
2429 | 2454 | toy_ec = os.path.join(self.test_prefix, os.path.basename(toy_ec)) |
|
0 commit comments