forked from idaholab/moose
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skip tests based on microarchitecture
Allow the TestHarness to skip tests based on micro architecture. Ref: idaholab#25294, as it was determined ARM64 fails to run certain tests. It may be best to skip these tests based on `machine` rather than `installation_type`. Or perhaps we leave it alone for now. Either way, this may become a useful feature in the TestHarness. Closes idaholab#25317
- Loading branch information
Showing
5 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#* This file is part of the MOOSE framework | ||
#* https://www.mooseframework.org | ||
#* | ||
#* All rights reserved, see COPYRIGHT for full restrictions | ||
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
#* | ||
#* Licensed under LGPL 2.1, please see LICENSE for details | ||
#* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
import os, sys, io | ||
import unittest | ||
import mock | ||
import TestHarness | ||
from contextlib import redirect_stdout | ||
|
||
class TestHarnessTester(unittest.TestCase): | ||
@mock.patch.object(TestHarness.util, 'getMachine') | ||
def mocked_output(self, mocked, expect_fail, mocked_return): | ||
MOOSE_DIR = os.getenv('MOOSE_DIR') | ||
os.chdir(f'{MOOSE_DIR}/test') | ||
out = io.StringIO() | ||
with redirect_stdout(out): | ||
mocked_return.return_value=mocked | ||
harness = TestHarness.TestHarness(['', '-i', 'always_ok', '-c'], MOOSE_DIR) | ||
if expect_fail: | ||
with self.assertRaises(SystemExit): | ||
harness.findAndRunTests() | ||
else: | ||
harness.findAndRunTests() | ||
return out.getvalue() | ||
|
||
def testNotSkipped(self): | ||
""" | ||
Test should not be skipped, as it is set to run on any arch (ALL) | ||
""" | ||
out = self.mocked_output(set(['ALL']), False) | ||
self.assertRegex(out, r'.*?OK.*?always_ok') | ||
|
||
def testSkipped(self): | ||
""" | ||
Test that a non existing machine type is skipped (remove default of ALL) | ||
""" | ||
out = self.mocked_output(set(['']), False) | ||
self.assertRegex(out, r'.*?SKIP.*?always_ok.*?MACHINE!=ALL') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters