diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ded9d856..936c7bd9 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -12,9 +12,9 @@ jobs:
python-version: ['3.7', '3.8', '3.9', '3.10']
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v1
+ uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Setup Compiler
diff --git a/docs/source/_templates/crown-copyright.html b/docs/source/_templates/crown-copyright.html
new file mode 100644
index 00000000..44657219
--- /dev/null
+++ b/docs/source/_templates/crown-copyright.html
@@ -0,0 +1,11 @@
+{# Crown copyright is displayed differently to normal. #}
+{# Configured from conf.py as per usual. #}
+{% if show_copyright and copyright %}
+
+ {% if hasdoc('copyright') %}
+ {% trans path=pathto('copyright'), copyright=copyright|e %}© Copyright {{ copyright }}.{% endtrans %}
+ {% else %}
+ {% trans copyright=copyright|e %}© Crown Copyright {{ copyright }}.{% endtrans %}
+ {% endif %}
+
+{% endif %}
diff --git a/docs/source/advanced_config.rst b/docs/source/advanced_config.rst
index 4fd4b74e..0e8a04d1 100644
--- a/docs/source/advanced_config.rst
+++ b/docs/source/advanced_config.rst
@@ -82,18 +82,22 @@ import your grab configuration to find out where it put the source.
if __name__ == '__main__':
with BuildConfig(project_label='') as state:
- grab_folder(state, src=grab_config.source_root),
+ grab_folder(state, src=my_grab_config.source_root),
Housekeeping
============
-Fab will remove old files from the prebuilds folder. It will remove all prebuild files that are not part of the current build by default.
+You can add a :func:`~fab.steps.cleanup_prebuilds.cleanup_prebuilds`
+step, where you can explicitly control how long to keep prebuild files.
+This may be useful, for example, if you often switch between two versions
+of your code and want to keep the prebuild speed benefits when building
+both.
-If you add a :func:`~fab.steps.cleanup_prebuilds.cleanup_prebuilds` step, you
-can keep prebuild files for longer. This may be useful, for example, if you
-often switch between two versions of your code and want to keep the prebuild
-speed benefits when building both.
+If you do not add your own cleanup_prebuild step, Fab will
+automatically run a default step which will remove old files from the
+prebuilds folder. It will remove all prebuild files that are not part of
+the current build by default.
Sharing Prebuilds
diff --git a/docs/source/api.rst b/docs/source/api.rst
new file mode 100644
index 00000000..6a5a1bbd
--- /dev/null
+++ b/docs/source/api.rst
@@ -0,0 +1,10 @@
+API Documentation
+=================
+
+This API documentation is generated from comments within the source code.
+
+.. autosummary::
+ :toctree: api
+ :recursive:
+
+ fab
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 68762f24..d036262f 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -17,8 +17,8 @@
# -- Project information -----------------------------------------------------
-project = 'fab'
-copyright = '2023'
+project = 'Fab'
+copyright = '2024 Met Office. All rights reserved.'
author = 'Fab Team'
# The full version, including alpha/beta/rc tags
@@ -52,24 +52,35 @@
exclude_patterns = []
-# -- Options for HTML output -------------------------------------------------
+# -- Autodoc -----------------------------------------------------------------
-# The theme to use for HTML and HTML Help pages. See the documentation for
-# a list of builtin themes.
-#
+autodoc_default_options = {
+ 'members': True,
+ 'show-inheritane': True
+}
-# ugly
-# html_theme = "classic"
+autoclass_content = 'both'
-# poor contrast between title, h1 & h2
-# html_theme = "sphinxdoc"
-# html_theme = "sphinx_rtd_theme"
-# html_theme = 'python_docs_theme'
-# good contrast between title, h1 & h2
-# html_theme = 'alabaster'
-html_theme = 'sphinx_material'
+# -- Options for HTML output -------------------------------------------------
+# The theme to use for HTML and HTML Help pages. See the documentation for
+# a list of builtin themes.
+#
+html_theme = 'pydata_sphinx_theme'
+
+html_theme_options = {
+ "icon_links": [
+ {
+ "name": "GitHub",
+ "url": "https://github.com/metomi/fab",
+ "icon": "fa-brands fa-github"
+ }
+ ],
+ "footer_start": ["crown-copyright"],
+ "footer_center": ["sphinx-version"],
+ "footer_end": ["theme-version"],
+}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
@@ -93,12 +104,3 @@
# include default values in argument descriptions
typehints_defaults = 'braces-after'
-
-# needed when using material theme
-html_sidebars = {
- "**": ["logo-text.html", "globaltoc.html", "localtoc.html", "searchbox.html"]
-}
-# needed when not using material theme
-# html_sidebars = {
-# "**": ["globaltoc.html", "searchbox.html"]
-# }
diff --git a/docs/source/environment.rst b/docs/source/environment.rst
index 8747efd9..ef5b40ee 100644
--- a/docs/source/environment.rst
+++ b/docs/source/environment.rst
@@ -3,11 +3,11 @@
Environment
***********
-Fab requires a suitible Python environment in which to run. This page outlines
+Fab requires a suitable Python environment in which to run. This page outlines
some routes to achieving such an environment.
This page contains general instructions, there are additional instructions for
-:ref:`Met Office` users elsewhere.
+:ref:`Met Office` users elsewhere.
.. _Requirements:
diff --git a/docs/source/index.rst b/docs/source/index.rst
index 0b5458c7..fc03936e 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -81,7 +81,7 @@ See also
writing_config
advanced_config
features
- Api Reference
+ Api Reference
development
glossary
genindex
diff --git a/docs/source/writing_config.rst b/docs/source/writing_config.rst
index 9795a8cb..aaab8471 100644
--- a/docs/source/writing_config.rst
+++ b/docs/source/writing_config.rst
@@ -236,14 +236,14 @@ However preprocessing C currently requires a preceding step called the
into the C code so Fab is able to deduce which inclusions are user code and
which are system code. This allows system dependencies to be ignored.
-See also :ref:`Advanced C Code`
+See also :ref:`Advanced C Code`
Further Reading
===============
More advanced configuration topics are discussed in
-:ref:`Advanced Configuration`.
+:ref:`Advanced Config`.
You can see more complicated configurations in the
`developer testing directory `_.
diff --git a/pyproject.toml b/pyproject.toml
index 9e242d43..76424ead 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -22,8 +22,11 @@ classifiers = [
c-language = ['python-clang']
plots = ['matplotlib']
tests = ['pytest', 'pytest-cov', 'pytest-mock']
-checks = ['flake8', 'mypy']
-docs = ['sphinx', 'sphinx-material', 'sphinx-autodoc-typehints', 'sphinx-copybutton']
+checks = ['flake8>=5.0.4', 'mypy']
+docs = ['sphinx',
+ 'pydata-sphinx-theme>=0.13.3',
+ 'sphinx-autodoc-typehints',
+ 'sphinx-copybutton']
dev = ['sci-fab[plots, tests, checks, docs]']
[project.scripts]
diff --git a/source/fab/steps/compile_fortran.py b/source/fab/steps/compile_fortran.py
index 41c4e380..f84e71fa 100644
--- a/source/fab/steps/compile_fortran.py
+++ b/source/fab/steps/compile_fortran.py
@@ -67,7 +67,7 @@ def compile_fortran(config: BuildConfig, common_flags: Optional[List[str]] = Non
A list of :class:`~fab.build_config.AddFlags`, defining flags to be included in the command line call
for selected files.
:param source:
- An :class:`~fab.artefacts.ArtefactsGetter` which give us our c files to process.
+ An :class:`~fab.artefacts.ArtefactsGetter` which gives us our Fortran files to process.
"""
diff --git a/source/fab/steps/grab/__init__.py b/source/fab/steps/grab/__init__.py
index eed72413..ed4bcf91 100644
--- a/source/fab/steps/grab/__init__.py
+++ b/source/fab/steps/grab/__init__.py
@@ -24,5 +24,5 @@ def call_rsync(src: Union[str, Path], dst: Union[str, Path]):
if not src.endswith('/'):
src += '/'
- command = ['rsync', '--times', '--stats', '-ru', src, str(dst)]
+ command = ['rsync', '--times', '--links', '--stats', '-ru', src, str(dst)]
return run_command(command)
diff --git a/tests/system_tests/CFortranInterop/test_CFortranInterop.py b/tests/system_tests/CFortranInterop/test_CFortranInterop.py
index 5e7b9067..483b6968 100644
--- a/tests/system_tests/CFortranInterop/test_CFortranInterop.py
+++ b/tests/system_tests/CFortranInterop/test_CFortranInterop.py
@@ -17,6 +17,7 @@
from fab.steps.link import link_exe
from fab.steps.preprocess import preprocess_fortran, preprocess_c
+import pytest
PROJECT_SOURCE = Path(__file__).parent / 'project-source'
@@ -24,7 +25,8 @@
def test_CFortranInterop(tmp_path):
# build
- with BuildConfig(fab_workspace=tmp_path, project_label='foo', multiprocessing=False) as config:
+ with BuildConfig(fab_workspace=tmp_path, project_label='foo', multiprocessing=False) as config, \
+ pytest.warns(UserWarning, match="removing managed flag"):
grab_folder(config, src=PROJECT_SOURCE),
find_source_files(config),
diff --git a/tests/system_tests/FortranDependencies/test_FortranDependencies.py b/tests/system_tests/FortranDependencies/test_FortranDependencies.py
index 48932b5c..6971bf83 100644
--- a/tests/system_tests/FortranDependencies/test_FortranDependencies.py
+++ b/tests/system_tests/FortranDependencies/test_FortranDependencies.py
@@ -17,11 +17,14 @@
from fab.steps.link import link_exe
from fab.steps.preprocess import preprocess_fortran
+import pytest
+
def test_FortranDependencies(tmp_path):
# build
- with BuildConfig(fab_workspace=tmp_path, project_label='foo', multiprocessing=False) as config:
+ with BuildConfig(fab_workspace=tmp_path, project_label='foo', multiprocessing=False) as config, \
+ pytest.warns(UserWarning, match="removing managed flag"):
grab_folder(config, src=Path(__file__).parent / 'project-source'),
find_source_files(config),
preprocess_fortran(config), # nothing to preprocess, actually, it's all little f90 files
diff --git a/tests/system_tests/FortranPreProcess/test_FortranPreProcess.py b/tests/system_tests/FortranPreProcess/test_FortranPreProcess.py
index 49652641..f45ea74c 100644
--- a/tests/system_tests/FortranPreProcess/test_FortranPreProcess.py
+++ b/tests/system_tests/FortranPreProcess/test_FortranPreProcess.py
@@ -15,9 +15,12 @@
from fab.steps.link import link_exe
from fab.steps.preprocess import preprocess_fortran
+import pytest
+
def build(fab_workspace, fpp_flags=None):
- with BuildConfig(fab_workspace=fab_workspace, project_label='foo', multiprocessing=False) as config:
+ with BuildConfig(fab_workspace=fab_workspace, project_label='foo', multiprocessing=False) as config, \
+ pytest.warns(UserWarning, match="removing managed flag"):
grab_folder(config, Path(__file__).parent / 'project-source'),
find_source_files(config),
preprocess_fortran(config, common_flags=fpp_flags),
diff --git a/tests/system_tests/MinimalFortran/test_MinimalFortran.py b/tests/system_tests/MinimalFortran/test_MinimalFortran.py
index 66fb221a..6dd7615f 100644
--- a/tests/system_tests/MinimalFortran/test_MinimalFortran.py
+++ b/tests/system_tests/MinimalFortran/test_MinimalFortran.py
@@ -15,13 +15,16 @@
from fab.steps.link import link_exe
from fab.steps.preprocess import preprocess_fortran
+import pytest
+
PROJECT_SOURCE = Path(__file__).parent / 'project-source'
def test_MinimalFortran(tmp_path):
# build
- with BuildConfig(fab_workspace=tmp_path, project_label='foo', multiprocessing=False) as config:
+ with BuildConfig(fab_workspace=tmp_path, project_label='foo', multiprocessing=False) as config, \
+ pytest.warns(UserWarning, match="removing managed flag"):
grab_folder(config, PROJECT_SOURCE),
find_source_files(config),
preprocess_fortran(config),
diff --git a/tests/system_tests/git/test_git.py b/tests/system_tests/git/test_git.py
index dabbc137..32895dfe 100644
--- a/tests/system_tests/git/test_git.py
+++ b/tests/system_tests/git/test_git.py
@@ -38,21 +38,25 @@ def url(self):
return 'https://github.com/metomi/fab-test-data.git'
def test_checkout_url(self, tmp_path, url, config):
- git_checkout(config, src=url, dst_label='tiny_fortran')
- # todo: The commit will keep changing. Perhaps make a non-changing branch
- assert current_commit(config.source_root / 'tiny_fortran') == '3cba55e'
+ with pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
+ git_checkout(config, src=url, dst_label='tiny_fortran')
+ # todo: The commit will keep changing. Perhaps make a non-changing branch
+ assert current_commit(config.source_root / 'tiny_fortran') == '3cba55e'
def test_checkout_branch(self, tmp_path, url, config):
- git_checkout(config, src=url, dst_label='tiny_fortran', revision='main')
- assert current_commit(config.source_root / 'tiny_fortran') == '3cba55e'
+ with pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
+ git_checkout(config, src=url, dst_label='tiny_fortran', revision='main')
+ assert current_commit(config.source_root / 'tiny_fortran') == '3cba55e'
def test_checkout_tag(self, tmp_path, url, config):
- git_checkout(config, src=url, dst_label='tiny_fortran', revision='early')
- assert current_commit(config.source_root / 'tiny_fortran') == 'ee56489'
+ with pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
+ git_checkout(config, src=url, dst_label='tiny_fortran', revision='early')
+ assert current_commit(config.source_root / 'tiny_fortran') == 'ee56489'
def test_checkout_commit(self, tmp_path, url, config):
- git_checkout(config, src=url, dst_label='tiny_fortran', revision='ee5648928893701c5dbccdbf0561c0038352a5ff')
- assert current_commit(config.source_root / 'tiny_fortran') == 'ee56489'
+ with pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
+ git_checkout(config, src=url, dst_label='tiny_fortran', revision='ee5648928893701c5dbccdbf0561c0038352a5ff')
+ assert current_commit(config.source_root / 'tiny_fortran') == 'ee56489'
# todo: we could do with a test to ensure left-over files from previous fetches are cleaned away
@@ -65,18 +69,25 @@ def repo_url(self, tmp_path):
shutil.unpack_archive(Path(__file__).parent / 'repo.tar.gz', tmp_path)
return f'file://{tmp_path}/repo'
+ @pytest.mark.filterwarnings("ignore: Python 3.14 will, "
+ "by default, filter extracted tar archives "
+ "and reject files or modify their metadata. "
+ "Use the filter argument to control this behavior.")
def test_vanilla(self, repo_url, config):
# checkout master
- git_checkout(config, src=repo_url, dst_label='tiny_fortran', revision='master')
- check_file = config.source_root / 'tiny_fortran/file1.txt'
- assert 'This is sentence one in file one.' in open(check_file).read()
+ with pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
+ git_checkout(config, src=repo_url, dst_label='tiny_fortran', revision='master')
+ check_file = config.source_root / 'tiny_fortran/file1.txt'
+ assert 'This is sentence one in file one.' in open(check_file).read()
- git_merge(config, src=repo_url, dst_label='tiny_fortran', revision='experiment_a')
- assert 'This is sentence one, with Experiment A modification.' in open(check_file).read()
+ with pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
+ git_merge(config, src=repo_url, dst_label='tiny_fortran', revision='experiment_a')
+ assert 'This is sentence one, with Experiment A modification.' in open(check_file).read()
with pytest.raises(RuntimeError):
git_merge(config, src=repo_url, dst_label='tiny_fortran', revision='experiment_b')
# The conflicted merge must have been aborted, check that we can do another checkout of master
- git_checkout(config, src=repo_url, dst_label='tiny_fortran', revision='master')
+ with pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
+ git_checkout(config, src=repo_url, dst_label='tiny_fortran', revision='master')
diff --git a/tests/system_tests/grab_archive/test_grab_archive.py b/tests/system_tests/grab_archive/test_grab_archive.py
index 73d7543e..aa4251ea 100644
--- a/tests/system_tests/grab_archive/test_grab_archive.py
+++ b/tests/system_tests/grab_archive/test_grab_archive.py
@@ -8,11 +8,14 @@
from fab.steps.grab.archive import grab_archive
+import pytest
+
class TestGrabArchive(object):
def test(self, tmp_path):
- tar_file = Path(__file__).parent / '../git/tiny_fortran.tar'
- grab_archive(config=mock.Mock(source_root=tmp_path), src=tar_file)
+ with pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
+ tar_file = Path(__file__).parent / '../git/tiny_fortran.tar'
+ grab_archive(config=mock.Mock(source_root=tmp_path), src=tar_file)
- assert (tmp_path / 'tiny_fortran/src/my_mod.F90').exists()
+ assert (tmp_path / 'tiny_fortran/src/my_mod.F90').exists()
diff --git a/tests/system_tests/psyclone/skeleton/algorithm/algorithm_mod.x90 b/tests/system_tests/psyclone/skeleton/algorithm/algorithm_mod.x90
index 62b412bf..be898fb0 100644
--- a/tests/system_tests/psyclone/skeleton/algorithm/algorithm_mod.x90
+++ b/tests/system_tests/psyclone/skeleton/algorithm/algorithm_mod.x90
@@ -46,7 +46,7 @@ contains
! Set the new field to a constant value and compute the divergence of it
divergence => get_div()
s = 2.0_r_def
- call invoke( name = "Compute divergence", &
+ call invoke( name = "Compute_divergence", &
setval_c(field_2, s ), &
setval_c(field_1, 0.0_r_def), &
my_kernel_type(field_1, field_2, divergence) )
diff --git a/tests/system_tests/psyclone/test_psyclone.py b/tests/system_tests/psyclone/test_psyclone_system_test.py
similarity index 84%
rename from tests/system_tests/psyclone/test_psyclone.py
rename to tests/system_tests/psyclone/test_psyclone_system_test.py
index 4a06502a..20cd7761 100644
--- a/tests/system_tests/psyclone/test_psyclone.py
+++ b/tests/system_tests/psyclone/test_psyclone_system_test.py
@@ -154,33 +154,39 @@ def test_run(self, config):
# if these files exist after the run then we know:
# a) the expected files were created
# b) the prebuilds were protected from automatic cleanup
- expect_files = [
- # there should be an f90 and a _psy.f90 built from the x90
- config.build_output / 'algorithm/algorithm_mod.f90',
- config.build_output / 'algorithm/algorithm_mod_psy.f90',
-
+ expect_prebuild_files = [
# Expect these prebuild files
- # todo: the kernal hash differs between fpp and cpp, perhaps just use wildcards.
- config.prebuild_folder / 'algorithm_mod.1602753696.an', # x90 analysis result
- config.prebuild_folder / 'my_kernel_mod.4187107526.an', # kernel analysis results
- config.prebuild_folder / 'algorithm_mod.5088673431.f90', # prebuild
- config.prebuild_folder / 'algorithm_mod_psy.5088673431.f90', # prebuild
+ # The kernel hash differs between fpp and cpp, so just use wildcards.
+ 'algorithm_mod.*.an', # x90 analysis result
+ 'my_kernel_mod.*.an', # kernel analysis results
+ 'algorithm_mod.*.f90', # prebuild
+ 'algorithm_mod_psy.*.f90', # prebuild
+ ]
+
+ expect_build_files = [
+ # there should be an f90 and a _psy.f90 built from the x90
+ 'algorithm/algorithm_mod.f90',
+ 'algorithm/algorithm_mod_psy.f90',
]
- assert all(not f.exists() for f in expect_files)
- with config:
+ # Glob returns a generator, which can't simply be tested if it's empty.
+ # So use a list instead:
+ assert all(list(config.prebuild_folder.glob(f)) == [] for f in expect_prebuild_files)
+ assert all(list(config.build_output.glob(f)) == [] for f in expect_build_files)
+ with config, pytest.warns(UserWarning, match="no transformation script specified"):
self.steps(config)
- assert all(f.exists() for f in expect_files)
+ assert all(list(config.prebuild_folder.glob(f)) != [] for f in expect_prebuild_files)
+ assert all(list(config.build_output.glob(f)) != [] for f in expect_build_files)
def test_prebuild(self, tmp_path, config):
- with config:
+ with config, pytest.warns(UserWarning, match="no transformation script specified"):
self.steps(config)
# make sure no work gets done the second time round
with mock.patch('fab.parse.x90.X90Analyser.walk_nodes') as mock_x90_walk:
with mock.patch('fab.parse.fortran.FortranAnalyser.walk_nodes') as mock_fortran_walk:
with mock.patch('fab.steps.psyclone.run_psyclone') as mock_run:
- with config:
+ with config, pytest.warns(UserWarning, match="no transformation script specified"):
self.steps(config)
mock_x90_walk.assert_not_called()
diff --git a/tests/system_tests/svn_fcm/test_svn_fcm.py b/tests/system_tests/svn_fcm/test_svn_fcm_system_test.py
similarity index 67%
rename from tests/system_tests/svn_fcm/test_svn_fcm.py
rename to tests/system_tests/svn_fcm/test_svn_fcm_system_test.py
index 532c5cac..da2de348 100644
--- a/tests/system_tests/svn_fcm/test_svn_fcm.py
+++ b/tests/system_tests/svn_fcm/test_svn_fcm_system_test.py
@@ -110,23 +110,34 @@ class TestExport(object):
# Run the test twice, once with SvnExport and once with FcmExport - depending on which tools are available.
@pytest.mark.parametrize('export_func', export_funcs)
+ @pytest.mark.filterwarnings("ignore: Python 3.14 will, "
+ "by default, filter extracted tar archives "
+ "and reject files or modify their metadata. "
+ "Use the filter argument to control this behavior.")
def test_export(self, file2_experiment, config, export_func):
# Export the "file 2 experiment" branch, which has different sentence from trunk in r1 and r2
- export_func(config, src=file2_experiment, dst_label='proj', revision=7)
- assert confirm_file2_experiment_r7(config)
+ with pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
+ export_func(config, src=file2_experiment, dst_label='proj', revision=7)
+ assert confirm_file2_experiment_r7(config)
# Make sure we can export twice into the same folder.
# Todo: should the export step wipe the destination first? To remove residual, orphaned files?
- export_func(config, src=file2_experiment, dst_label='proj', revision=8)
- assert confirm_file2_experiment_r8(config)
+ with pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
+ export_func(config, src=file2_experiment, dst_label='proj', revision=8)
+ assert confirm_file2_experiment_r8(config)
+@pytest.mark.filterwarnings("ignore: Python 3.14 will, "
+ "by default, filter extracted tar archives "
+ "and reject files or modify their metadata. "
+ "Use the filter argument to control this behavior.")
class TestCheckout(object):
@pytest.mark.parametrize('checkout_func', checkout_funcs)
def test_new_folder(self, trunk, config, checkout_func):
- checkout_func(config, src=trunk, dst_label='proj')
- assert confirm_trunk(config)
+ with pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
+ checkout_func(config, src=trunk, dst_label='proj')
+ assert confirm_trunk(config)
@pytest.mark.parametrize('checkout_func', checkout_funcs)
def test_working_copy(self, file2_experiment, config, checkout_func):
@@ -143,7 +154,8 @@ def test_working_copy(self, file2_experiment, config, checkout_func):
else:
assert False
- with mock.patch('fab.steps.grab.svn.run_command', wraps=fab.steps.grab.svn.run_command) as wrap:
+ with mock.patch('fab.steps.grab.svn.run_command', wraps=fab.steps.grab.svn.run_command) as wrap, \
+ pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
checkout_func(config, src=file2_experiment, dst_label='proj', revision='7')
assert confirm_file2_experiment_r7(config)
@@ -160,38 +172,46 @@ def test_working_copy(self, file2_experiment, config, checkout_func):
@pytest.mark.parametrize('export_func,checkout_func', zip(export_funcs, checkout_funcs))
def test_not_working_copy(self, trunk, config, export_func, checkout_func):
# the export command just makes files, not a working copy
- export_func(config, src=trunk, dst_label='proj')
+ with pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
+ export_func(config, src=trunk, dst_label='proj')
# if we try to checkout into that folder, it should fail
with pytest.raises(ValueError):
checkout_func(config, src=trunk, dst_label='proj')
+@pytest.mark.filterwarnings("ignore: Python 3.14 will, "
+ "by default, filter extracted tar archives "
+ "and reject files or modify their metadata. "
+ "Use the filter argument to control this behavior.")
class TestMerge(object):
@pytest.mark.parametrize('checkout_func,merge_func', zip(checkout_funcs, merge_funcs))
def test_vanilla(self, trunk, file2_experiment, config, checkout_func, merge_func):
- # something to merge into; checkout trunk
- checkout_func(config, src=trunk, dst_label='proj')
- confirm_trunk(config)
+ with pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
+ # something to merge into; checkout trunk
+ checkout_func(config, src=trunk, dst_label='proj')
+ confirm_trunk(config)
- # merge another branch in
- merge_func(config, src=file2_experiment, dst_label='proj')
- confirm_file2_experiment_r8(config)
+ # merge another branch in
+ merge_func(config, src=file2_experiment, dst_label='proj')
+ confirm_file2_experiment_r8(config)
@pytest.mark.parametrize('checkout_func,merge_func', zip(checkout_funcs, merge_funcs))
def test_revision(self, trunk, file2_experiment, config, checkout_func, merge_func):
- # something to merge into; checkout trunk
- checkout_func(config, src=trunk, dst_label='proj')
- confirm_trunk(config)
+ with pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
+ # something to merge into; checkout trunk
+ checkout_func(config, src=trunk, dst_label='proj')
+ confirm_trunk(config)
- # merge another branch in
- merge_func(config, src=file2_experiment, dst_label='proj', revision=7)
- confirm_file2_experiment_r7(config)
+ # merge another branch in
+ merge_func(config, src=file2_experiment, dst_label='proj', revision=7)
+ confirm_file2_experiment_r7(config)
@pytest.mark.parametrize('export_func,merge_func', zip(export_funcs, merge_funcs))
def test_not_working_copy(self, trunk, file2_experiment, config, export_func, merge_func):
- export_func(config, src=trunk, dst_label='proj')
+ with pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
+ export_func(config, src=trunk, dst_label='proj')
# try to merge into an export
with pytest.raises(ValueError):
@@ -199,8 +219,9 @@ def test_not_working_copy(self, trunk, file2_experiment, config, export_func, me
@pytest.mark.parametrize('checkout_func,merge_func', zip(checkout_funcs, merge_funcs))
def test_conflict(self, file1_experiment_a, file1_experiment_b, config, checkout_func, merge_func):
- checkout_func(config, src=file1_experiment_a, dst_label='proj')
- confirm_file1_experiment_a(config)
+ with pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
+ checkout_func(config, src=file1_experiment_a, dst_label='proj')
+ confirm_file1_experiment_a(config)
# this branch modifies the same line of text
with pytest.raises(RuntimeError):
@@ -208,11 +229,12 @@ def test_conflict(self, file1_experiment_a, file1_experiment_b, config, checkout
@pytest.mark.parametrize('checkout_func,merge_func', zip(checkout_funcs, merge_funcs))
def test_multiple_merges(self, trunk, file1_experiment_a, file2_experiment, config, checkout_func, merge_func):
- checkout_func(config, src=trunk, dst_label='proj')
- confirm_trunk(config)
+ with pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
+ checkout_func(config, src=trunk, dst_label='proj')
+ confirm_trunk(config)
- merge_func(config, src=file1_experiment_a, dst_label='proj')
- confirm_file1_experiment_a(config)
+ merge_func(config, src=file1_experiment_a, dst_label='proj')
+ confirm_file1_experiment_a(config)
- merge_func(config, src=file2_experiment, dst_label='proj', revision=7)
- confirm_file2_experiment_r7(config)
+ merge_func(config, src=file2_experiment, dst_label='proj', revision=7)
+ confirm_file2_experiment_r7(config)
diff --git a/tests/system_tests/zero_config/test_zero_config.py b/tests/system_tests/zero_config/test_zero_config.py
index 704c0b93..5ae56b3d 100644
--- a/tests/system_tests/zero_config/test_zero_config.py
+++ b/tests/system_tests/zero_config/test_zero_config.py
@@ -5,29 +5,33 @@
import os
from unittest import mock
+import pytest
+
class TestZeroConfig(object):
def test_fortran_dependencies(self, tmp_path):
# test the sample project in the fortran dependencies system test
- kwargs = {'project_label': 'fortran deps test', 'fab_workspace': tmp_path, 'multiprocessing': False}
+ with pytest.warns(DeprecationWarning, match="RootIncFiles is deprecated as .inc files are due to be removed."):
+ kwargs = {'project_label': 'fortran deps test', 'fab_workspace': tmp_path, 'multiprocessing': False}
- config = cli_fab(
- folder=Path(__file__).parent.parent / 'FortranDependencies',
- kwargs=kwargs)
+ config = cli_fab(
+ folder=Path(__file__).parent.parent / 'FortranDependencies',
+ kwargs=kwargs)
- assert (config.project_workspace / 'first').exists()
- assert (config.project_workspace / 'second').exists()
+ assert (config.project_workspace / 'first').exists()
+ assert (config.project_workspace / 'second').exists()
def test_c_fortran_interop(self, tmp_path):
# test the sample project in the fortran dependencies system test
- kwargs = {'project_label': 'CFInterop test', 'fab_workspace': tmp_path, 'multiprocessing': 'False'}
+ with pytest.warns(DeprecationWarning, match="RootIncFiles is deprecated as .inc files are due to be removed."):
+ kwargs = {'project_label': 'CFInterop test', 'fab_workspace': tmp_path, 'multiprocessing': 'False'}
- config = cli_fab(
- folder=Path(__file__).parent.parent / 'CFortranInterop',
- kwargs=kwargs)
+ config = cli_fab(
+ folder=Path(__file__).parent.parent / 'CFortranInterop',
+ kwargs=kwargs)
- assert (config.project_workspace / 'main').exists()
+ assert (config.project_workspace / 'main').exists()
def test_fortran_explicit_gfortran(self, tmp_path):
# test the sample project in the fortran dependencies system test
@@ -36,7 +40,8 @@ def test_fortran_explicit_gfortran(self, tmp_path):
cc = shutil.which('gcc')
fc = shutil.which('gfortran')
- with mock.patch.dict(os.environ, CC=cc, FC=fc, LD=fc):
+ with mock.patch.dict(os.environ, CC=cc, FC=fc, LD=fc), \
+ pytest.warns(DeprecationWarning, match="RootIncFiles is deprecated as .inc files are due to be removed."):
config = cli_fab(
folder=Path(__file__).parent.parent / 'CFortranInterop',
kwargs=kwargs)
diff --git a/tests/unit_tests/steps/grab/test_svn_fcm.py b/tests/unit_tests/steps/grab/test_svn_fcm_unit_test.py
similarity index 100%
rename from tests/unit_tests/steps/grab/test_svn_fcm.py
rename to tests/unit_tests/steps/grab/test_svn_fcm_unit_test.py
diff --git a/tests/unit_tests/steps/test_analyse.py b/tests/unit_tests/steps/test_analyse.py
index 7405939c..0e1db71b 100644
--- a/tests/unit_tests/steps/test_analyse.py
+++ b/tests/unit_tests/steps/test_analyse.py
@@ -115,7 +115,10 @@ class Test_parse_files(object):
def test_exceptions(self, tmp_path):
# make sure parse exceptions do not stop the build
- with mock.patch('fab.steps.run_mp', return_value=[(Exception('foo'), None)]):
+ with mock.patch('fab.steps.run_mp', return_value=[(Exception('foo'), None)]), \
+ pytest.warns(UserWarning, match="deprecated 'DEPENDS ON:'"):
+ # The warning "deprecated 'DEPENDS ON:' comment found in fortran code"
+ # is in "def _parse_files" in "source/steps/analyse.py"
config = BuildConfig('proj', fab_workspace=tmp_path)
# the exception should be suppressed (and logged) and this step should run to completion
@@ -130,7 +133,10 @@ def test_vanilla(self):
workaround = FortranParserWorkaround(fpath=Path('foo.f'), symbol_defs={'foo', })
analysed_files = set()
- with mock.patch('fab.parse.fortran.file_checksum', return_value=HashedFile(None, 123)):
+ with mock.patch('fab.parse.fortran.file_checksum', return_value=HashedFile(None, 123)), \
+ pytest.warns(UserWarning, match="SPECIAL MEASURE: injecting user-defined analysis results"):
+ # This warning "UserWarning: SPECIAL MEASURE: injecting user-defined analysis results"
+ # is in "def _add_manual_results" in "source/steps/analyse.py"
_add_manual_results(special_measure_analysis_results=[workaround], analysed_files=analysed_files)
assert analysed_files == {AnalysedFortran(fpath=Path('foo.f'), file_hash=123, symbol_defs={'foo', })}
diff --git a/tests/unit_tests/steps/test_archive_objects.py b/tests/unit_tests/steps/test_archive_objects.py
index 2d7ab1bb..0600d85c 100644
--- a/tests/unit_tests/steps/test_archive_objects.py
+++ b/tests/unit_tests/steps/test_archive_objects.py
@@ -5,6 +5,8 @@
from fab.constants import OBJECT_FILES, OBJECT_ARCHIVES
from fab.steps.archive_objects import archive_objects
+import pytest
+
class Test_archive_objects(object):
@@ -15,7 +17,8 @@ def test_for_exes(self):
config = BuildConfig('proj')
config._artefact_store = {OBJECT_FILES: {target: [f'{target}.o', 'util.o'] for target in targets}}
- with mock.patch('fab.steps.archive_objects.run_command') as mock_run_command:
+ with mock.patch('fab.steps.archive_objects.run_command') as mock_run_command, \
+ pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
archive_objects(config=config)
# ensure the correct command line calls were made
@@ -36,7 +39,8 @@ def test_for_library(self):
config = BuildConfig('proj')
config._artefact_store = {OBJECT_FILES: {None: ['util1.o', 'util2.o']}}
- with mock.patch('fab.steps.archive_objects.run_command') as mock_run_command:
+ with mock.patch('fab.steps.archive_objects.run_command') as mock_run_command, \
+ pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
archive_objects(config=config, output_fpath=config.build_output / 'mylib.a')
# ensure the correct command line calls were made
diff --git a/tests/unit_tests/steps/test_cleanup_prebuilds.py b/tests/unit_tests/steps/test_cleanup_prebuilds.py
index 21cddb63..ec15acc7 100644
--- a/tests/unit_tests/steps/test_cleanup_prebuilds.py
+++ b/tests/unit_tests/steps/test_cleanup_prebuilds.py
@@ -18,7 +18,8 @@
class TestCleanupPrebuilds(object):
def test_init_no_args(self):
- with mock.patch('fab.steps.cleanup_prebuilds.file_walk', return_value=[Path('foo.o')]):
+ with mock.patch('fab.steps.cleanup_prebuilds.file_walk', return_value=[Path('foo.o')]), \
+ pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
with mock.patch('fab.steps.cleanup_prebuilds.remove_all_unused') as mock_remove_all_unused:
cleanup_prebuilds(config=mock.Mock(_artefact_store={CURRENT_PREBUILDS: [Path('bar.o')]}))
mock_remove_all_unused.assert_called_once_with(found_files=[Path('foo.o')], current_files=[Path('bar.o')])
diff --git a/tests/unit_tests/steps/test_compile_c.py b/tests/unit_tests/steps/test_compile_c.py
index 9855f3d7..13f20223 100644
--- a/tests/unit_tests/steps/test_compile_c.py
+++ b/tests/unit_tests/steps/test_compile_c.py
@@ -36,7 +36,8 @@ def test_vanilla(self, content):
send_metric=DEFAULT,
get_compiler_version=mock.Mock(return_value='1.2.3')) as values:
with mock.patch('pathlib.Path.mkdir'):
- with mock.patch.dict(os.environ, {'CC': 'foo_cc', 'CFLAGS': '-Denv_flag'}):
+ with mock.patch.dict(os.environ, {'CC': 'foo_cc', 'CFLAGS': '-Denv_flag'}), \
+ pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
compile_c(
config=config, path_flags=[AddFlags(match='$source/*', flags=['-I', 'foo/include', '-Dhello'])])
diff --git a/tests/unit_tests/steps/test_compile_fortran.py b/tests/unit_tests/steps/test_compile_fortran.py
index a2a0c3cd..7f42662a 100644
--- a/tests/unit_tests/steps/test_compile_fortran.py
+++ b/tests/unit_tests/steps/test_compile_fortran.py
@@ -182,7 +182,8 @@ def test_without_prebuild(self):
with mock.patch('pathlib.Path.exists', return_value=False): # no output files exist
with mock.patch('fab.steps.compile_fortran.compile_file') as mock_compile_file:
- with mock.patch('shutil.copy2') as mock_copy:
+ with mock.patch('shutil.copy2') as mock_copy, \
+ pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
res, artefacts = process_file((analysed_file, mp_common_args))
# check we got the expected compilation result
@@ -210,7 +211,8 @@ def test_with_prebuild(self):
with mock.patch('pathlib.Path.exists', return_value=True): # mod def files and obj file all exist
with mock.patch('fab.steps.compile_fortran.compile_file') as mock_compile_file:
- with mock.patch('shutil.copy2') as mock_copy:
+ with mock.patch('shutil.copy2') as mock_copy, \
+ pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
res, artefacts = process_file((analysed_file, mp_common_args))
expect_object_fpath = Path(f'/fab/proj/build_output/_prebuild/foofile.{obj_combo_hash}.o')
@@ -238,7 +240,8 @@ def test_file_hash(self):
with mock.patch('pathlib.Path.exists', side_effect=[True, True, False]): # mod files exist, obj file doesn't
with mock.patch('fab.steps.compile_fortran.compile_file') as mock_compile_file:
- with mock.patch('shutil.copy2') as mock_copy:
+ with mock.patch('shutil.copy2') as mock_copy, \
+ pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
res, artefacts = process_file((analysed_file, mp_common_args))
expect_object_fpath = Path(f'/fab/proj/build_output/_prebuild/foofile.{obj_combo_hash}.o')
@@ -262,7 +265,8 @@ def test_flags_hash(self):
with mock.patch('pathlib.Path.exists', side_effect=[True, True, False]): # mod files exist, obj file doesn't
with mock.patch('fab.steps.compile_fortran.compile_file') as mock_compile_file:
- with mock.patch('shutil.copy2') as mock_copy:
+ with mock.patch('shutil.copy2') as mock_copy, \
+ pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
res, artefacts = process_file((analysed_file, mp_common_args))
expect_object_fpath = Path(f'/fab/proj/build_output/_prebuild/foofile.{obj_combo_hash}.o')
@@ -290,7 +294,8 @@ def test_deps_hash(self):
with mock.patch('pathlib.Path.exists', side_effect=[True, True, False]): # mod files exist, obj file doesn't
with mock.patch('fab.steps.compile_fortran.compile_file') as mock_compile_file:
- with mock.patch('shutil.copy2') as mock_copy:
+ with mock.patch('shutil.copy2') as mock_copy, \
+ pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
res, artefacts = process_file((analysed_file, mp_common_args))
expect_object_fpath = Path(f'/fab/proj/build_output/_prebuild/foofile.{obj_combo_hash}.o')
@@ -317,7 +322,8 @@ def test_compiler_hash(self):
with mock.patch('pathlib.Path.exists', side_effect=[True, True, False]): # mod files exist, obj file doesn't
with mock.patch('fab.steps.compile_fortran.compile_file') as mock_compile_file:
- with mock.patch('shutil.copy2') as mock_copy:
+ with mock.patch('shutil.copy2') as mock_copy, \
+ pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
res, artefacts = process_file((analysed_file, mp_common_args))
expect_object_fpath = Path(f'/fab/proj/build_output/_prebuild/foofile.{obj_combo_hash}.o')
@@ -344,7 +350,8 @@ def test_compiler_version_hash(self):
with mock.patch('pathlib.Path.exists', side_effect=[True, True, False]): # mod files exist, obj file doesn't
with mock.patch('fab.steps.compile_fortran.compile_file') as mock_compile_file:
- with mock.patch('shutil.copy2') as mock_copy:
+ with mock.patch('shutil.copy2') as mock_copy, \
+ pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
res, artefacts = process_file((analysed_file, mp_common_args))
expect_object_fpath = Path(f'/fab/proj/build_output/_prebuild/foofile.{obj_combo_hash}.o')
@@ -367,7 +374,8 @@ def test_mod_missing(self):
with mock.patch('pathlib.Path.exists', side_effect=[False, True, True]): # one mod file missing
with mock.patch('fab.steps.compile_fortran.compile_file') as mock_compile_file:
- with mock.patch('shutil.copy2') as mock_copy:
+ with mock.patch('shutil.copy2') as mock_copy, \
+ pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
res, artefacts = process_file((analysed_file, mp_common_args))
expect_object_fpath = Path(f'/fab/proj/build_output/_prebuild/foofile.{obj_combo_hash}.o')
@@ -390,7 +398,8 @@ def test_obj_missing(self):
with mock.patch('pathlib.Path.exists', side_effect=[True, True, False]): # object file missing
with mock.patch('fab.steps.compile_fortran.compile_file') as mock_compile_file:
- with mock.patch('shutil.copy2') as mock_copy:
+ with mock.patch('shutil.copy2') as mock_copy, \
+ pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
res, artefacts = process_file((analysed_file, mp_common_args))
expect_object_fpath = Path(f'/fab/proj/build_output/_prebuild/foofile.{obj_combo_hash}.o')
@@ -426,14 +435,16 @@ def test_with_flags(self):
def test_gfortran_managed_flags(self):
with mock.patch.dict(os.environ, FC='gfortran -c', FFLAGS='-J /mods'):
- with mock.patch('fab.steps.compile_fortran.get_compiler_version'):
+ with mock.patch('fab.steps.compile_fortran.get_compiler_version'), \
+ pytest.warns(UserWarning, match="removing managed flag"):
compiler, compiler_version, flags = handle_compiler_args()
assert compiler == 'gfortran'
assert flags.common_flags == []
def test_ifort_managed_flags(self):
with mock.patch.dict(os.environ, FC='ifort -c', FFLAGS='-module /mods'):
- with mock.patch('fab.steps.compile_fortran.get_compiler_version'):
+ with mock.patch('fab.steps.compile_fortran.get_compiler_version'), \
+ pytest.warns(UserWarning, match="removing managed flag"):
compiler, compiler_version, flags = handle_compiler_args()
assert compiler == 'ifort'
assert flags.common_flags == []
diff --git a/tests/unit_tests/steps/test_grab.py b/tests/unit_tests/steps/test_grab.py
index 409b1fa9..cb4292db 100644
--- a/tests/unit_tests/steps/test_grab.py
+++ b/tests/unit_tests/steps/test_grab.py
@@ -10,14 +10,18 @@
from fab.steps.grab.fcm import fcm_export
from fab.steps.grab.folder import grab_folder
+import pytest
+
class TestGrabFolder(object):
def test_trailing_slash(self):
- self._common(grab_src='/grab/source/', expect_grab_src='/grab/source/')
+ with pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
+ self._common(grab_src='/grab/source/', expect_grab_src='/grab/source/')
def test_no_trailing_slash(self):
- self._common(grab_src='/grab/source', expect_grab_src='/grab/source/')
+ with pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
+ self._common(grab_src='/grab/source', expect_grab_src='/grab/source/')
def _common(self, grab_src, expect_grab_src):
source_root = Path('/workspace/source')
@@ -29,7 +33,8 @@ def _common(self, grab_src, expect_grab_src):
grab_folder(mock_config, src=grab_src, dst_label=dst)
expect_dst = mock_config.source_root / dst
- mock_run.assert_called_once_with(['rsync', '--times', '--stats', '-ru', expect_grab_src, str(expect_dst)])
+ mock_run.assert_called_once_with(['rsync', '--times', '--links', '--stats',
+ '-ru', expect_grab_src, str(expect_dst)])
class TestGrabFcm(object):
@@ -41,7 +46,8 @@ def test_no_revision(self):
mock_config = SimpleNamespace(source_root=source_root)
with mock.patch('pathlib.Path.mkdir'):
- with mock.patch('fab.steps.grab.svn.run_command') as mock_run:
+ with mock.patch('fab.steps.grab.svn.run_command') as mock_run, \
+ pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
fcm_export(config=mock_config, src=source_url, dst_label=dst_label)
mock_run.assert_called_once_with(['fcm', 'export', '--force', source_url, str(source_root / dst_label)])
@@ -54,7 +60,8 @@ def test_revision(self):
mock_config = SimpleNamespace(source_root=source_root)
with mock.patch('pathlib.Path.mkdir'):
- with mock.patch('fab.steps.grab.svn.run_command') as mock_run:
+ with mock.patch('fab.steps.grab.svn.run_command') as mock_run, \
+ pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
fcm_export(mock_config, src=source_url, dst_label=dst_label, revision=revision)
mock_run.assert_called_once_with(
diff --git a/tests/unit_tests/steps/test_link.py b/tests/unit_tests/steps/test_link.py
index b7e3fd5e..cfee8f9a 100644
--- a/tests/unit_tests/steps/test_link.py
+++ b/tests/unit_tests/steps/test_link.py
@@ -10,6 +10,8 @@
from fab.constants import OBJECT_FILES
from fab.steps.link import link_exe
+import pytest
+
class TestLinkExe(object):
def test_run(self):
@@ -21,7 +23,8 @@ def test_run(self):
)
with mock.patch('os.getenv', return_value='-L/foo1/lib -L/foo2/lib'):
- with mock.patch('fab.steps.link.run_command') as mock_run:
+ with mock.patch('fab.steps.link.run_command') as mock_run, \
+ pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
link_exe(config, linker='foolink', flags=['-fooflag', '-barflag'])
mock_run.assert_called_with([
diff --git a/tests/unit_tests/steps/test_psyclone.py b/tests/unit_tests/steps/test_psyclone_unit_test.py
similarity index 100%
rename from tests/unit_tests/steps/test_psyclone.py
rename to tests/unit_tests/steps/test_psyclone_unit_test.py
diff --git a/tests/unit_tests/steps/test_root_inc_files.py b/tests/unit_tests/steps/test_root_inc_files.py
index e3037cce..3bb55cee 100644
--- a/tests/unit_tests/steps/test_root_inc_files.py
+++ b/tests/unit_tests/steps/test_root_inc_files.py
@@ -17,7 +17,8 @@ def test_vanilla(self):
config._artefact_store['all_source'] = inc_files
with mock.patch('fab.steps.root_inc_files.shutil') as mock_shutil:
- with mock.patch('fab.steps.root_inc_files.Path.mkdir'):
+ with mock.patch('fab.steps.root_inc_files.Path.mkdir'), \
+ pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
root_inc_files(config)
mock_shutil.copy.assert_called_once_with(inc_files[0], config.build_output)
@@ -29,7 +30,8 @@ def test_skip_output_folder(self):
config._artefact_store['all_source'] = inc_files
with mock.patch('fab.steps.root_inc_files.shutil') as mock_shutil:
- with mock.patch('fab.steps.root_inc_files.Path.mkdir'):
+ with mock.patch('fab.steps.root_inc_files.Path.mkdir'), \
+ pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
root_inc_files(config)
mock_shutil.copy.assert_called_once_with(inc_files[0], config.build_output)
@@ -43,5 +45,7 @@ def test_name_clash(self):
with pytest.raises(FileExistsError):
with mock.patch('fab.steps.root_inc_files.shutil'):
- with mock.patch('fab.steps.root_inc_files.Path.mkdir'):
+ with mock.patch('fab.steps.root_inc_files.Path.mkdir'), \
+ pytest.warns(DeprecationWarning,
+ match="RootIncFiles is deprecated as .inc files are due to be removed."):
root_inc_files(config)
diff --git a/tests/unit_tests/test_tools.py b/tests/unit_tests/test_tools.py
index 8edcb437..1898ff7f 100644
--- a/tests/unit_tests/test_tools.py
+++ b/tests/unit_tests/test_tools.py
@@ -15,12 +15,14 @@ class Test_remove_managed_flags(object):
def test_gfortran(self):
flags = ['--foo', '-J', 'nope', '--bar']
- result = remove_managed_flags('gfortran', flags)
+ with pytest.warns(UserWarning, match="removing managed flag"):
+ result = remove_managed_flags('gfortran', flags)
assert result == ['--foo', '--bar']
def test_ifort(self):
flags = ['--foo', '-module', 'nope', '--bar']
- result = remove_managed_flags('ifort', flags)
+ with pytest.warns(UserWarning, match="removing managed flag"):
+ result = remove_managed_flags('ifort', flags)
assert result == ['--foo', '--bar']
def test_unknown_compiler(self):