From a54d24c32861463b9a0c923b75c4e31c881a11fc Mon Sep 17 00:00:00 2001 From: Luke Carrier Date: Fri, 8 Mar 2024 00:35:40 +0000 Subject: [PATCH] `warn` => `warning` Fixes #43 --- mkdocs_drawio_exporter/exporter.py | 4 ++-- mkdocs_drawio_exporter/plugin.py | 2 +- mkdocs_drawio_exporter/tests/exporter.py | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mkdocs_drawio_exporter/exporter.py b/mkdocs_drawio_exporter/exporter.py index e050b03..e1c5532 100644 --- a/mkdocs_drawio_exporter/exporter.py +++ b/mkdocs_drawio_exporter/exporter.py @@ -159,7 +159,7 @@ def drawio_executable_paths(self, platform): program_files.append(os.environ['ProgramFiles(x86)']) return [os.path.join(dir, 'draw.io', 'draw.io.exe') for dir in program_files] else: - self.log.warn('Draw.io executable paths not known for platform "{}"'.format(platform)) + self.log.warning('Draw.io executable paths not known for platform "{}"'.format(platform)) def prepare_cache_dir(self, cache_dir, docs_dir): """Ensure the cache path is set, absolute and exists. @@ -264,7 +264,7 @@ def ensure_file_cached(self, source, source_rel, page_index, drawio_executable, self.log.debug('Source file appears unchanged; using cached copy from "{}"'.format(cache_filename)) else: if not drawio_executable: - self.log.warn('Skipping export of "{}" as Draw.io executable not available'.format(source)) + self.log.warning('Skipping export of "{}" as Draw.io executable not available'.format(source)) return (None, exit_status) self.log.debug('Exporting "{}" to "{}"'.format(source, cache_filename)) diff --git a/mkdocs_drawio_exporter/plugin.py b/mkdocs_drawio_exporter/plugin.py index a815ec5..79774d9 100644 --- a/mkdocs_drawio_exporter/plugin.py +++ b/mkdocs_drawio_exporter/plugin.py @@ -91,4 +91,4 @@ def on_post_build(self, config): try: copy_file(cache_filename, abs_dest_path) except FileNotFoundError: - log.warn('Export successful, but wrote no output file') + log.warning('Export successful, but wrote no output file') diff --git a/mkdocs_drawio_exporter/tests/exporter.py b/mkdocs_drawio_exporter/tests/exporter.py index 228b530..7ed04d5 100644 --- a/mkdocs_drawio_exporter/tests/exporter.py +++ b/mkdocs_drawio_exporter/tests/exporter.py @@ -27,9 +27,9 @@ def setUp(self): self.exporter = DrawIoExporter(self.log) def test_drawio_executable_paths_warns_on_unknown_platform(self): - self.log.warn = MagicMock() + self.log.warning = MagicMock() self.exporter.drawio_executable_paths('win32-but-stable') - self.log.warn.assert_called_once() + self.log.warning.assert_called_once() def test_prepare_cache_dir_defaults(self): assert len(self.exporter.prepare_cache_dir(None, sep + 'docs')) @@ -138,13 +138,13 @@ def test_ensure_file_cached_aborts_if_drawio_executable_unavailable(self): self.exporter.export_file = MagicMock() self.exporter.export_file.return_value = 0 - self.log.warn = MagicMock() + self.log.warning = MagicMock() cache_filename, exit_status = self.exporter.ensure_file_cached( source, source_rel, 0, drawio_executable, [], cache_dir, 'svg') assert exit_status == None - self.log.warn.assert_called_once() + self.log.warning.assert_called_once() def test_ensure_file_cached_skips_export_if_cache_fresh(self): source = sep + join('docs', 'diagram.drawio')