hiker / fab

Flexible build system for scientific software
https://metomi.github.io/fab/
Other
1 stars 0 forks source link

Testing issues #5

Closed hiker closed 7 months ago

hiker commented 7 months ago

I get several warnings, because a warning is logged (as expected) by fab, i.e. these should not trigger a warning for a test, it should be ignored. The following patch disables two of them:

 git diff tests/unit_tests/test_tools.py
diff --git a/tests/unit_tests/test_tools.py b/tests/unit_tests/test_tools.py
index 8edcb43..8de0c89 100644
--- a/tests/unit_tests/test_tools.py
+++ b/tests/unit_tests/test_tools.py
@@ -13,11 +13,15 @@ from fab.tools import remove_managed_flags, flags_checksum, get_tool, get_compil

 class Test_remove_managed_flags(object):

+    @pytest.mark.filterwarnings("ignore: removing managed flag -J "
+                                "for compiler gfortran")
     def test_gfortran(self):
         flags = ['--foo', '-J', 'nope', '--bar']
         result = remove_managed_flags('gfortran', flags)
         assert result == ['--foo', '--bar']

+    @pytest.mark.filterwarnings("ignore: removing managed flag -module "
+                                "for compiler ifort")
     def test_ifort(self):
         flags = ['--foo', '-module', 'nope', '--bar']
         result = remove_managed_flags('ifort', flags)

This seems to work fine, i.e. if the warning message changes, we will see a warning again.

Ideally, we should actually check in the tests that these warnings are issued (so we get a failure if they disappear, which I don't think the above code will do).

Also, there are duplicated filenames in various subdirectories:

2 x test_psyclone.py
2 x test_svn_fcm.py

pytest doesn't like that. So either we need to see how UKMO is running tests, run tests independently in system_tests unit_tests (which seems to be stupid :) ), or rename them to avoid the name clash.

hiker commented 7 months ago

All fixed with #9 and #10, closing this issue now.