chiark / gitweb /
documentation/doxygen: ah so that's why the warning is uncovered.
authorVladimír Vondruš <mosra@centrum.cz>
Sun, 9 Jan 2022 22:45:36 +0000 (23:45 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Sun, 9 Jan 2022 22:50:25 +0000 (23:50 +0100)
Because 1.8.16+ just directly drops the whole <dotfile> tag if the
source doesn't exist. What a marvellous idea!!!

documentation/doxygen.py
documentation/test_doxygen/contents_dot/warnings_1815.html [new file with mode: 0644]
documentation/test_doxygen/test_contents.py

index e29d4f363197aadddab68bad23bb6638960eb539..fb1d2c3a3e311d50768f63c2d49174b2b2ff8dc3 100755 (executable)
@@ -1054,6 +1054,9 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET.
                 if 'name' in i.attrib:
                     with open(i.attrib['name'], 'r') as f:
                         source = f.read()
+                # Since 1.8.16 the whole <dotfile> tag is dropped if the file
+                # doesn't exist. Such a great solution that it's unfathomable.
+                # FFS.
                 else:
                     logging.warning("{}: file passed to @dotfile was not found, rendering an empty graph".format(state.current))
                     source = 'digraph "" {}'
diff --git a/documentation/test_doxygen/contents_dot/warnings_1815.html b/documentation/test_doxygen/contents_dot/warnings_1815.html
new file mode 100644 (file)
index 0000000..56bb622
--- /dev/null
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>warnings | My Project</title>
+  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
+  <link rel="stylesheet" href="m-dark+documentation.compiled.css" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+  <div class="m-container">
+    <div class="m-row">
+      <a href="index.html" id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">My Project</a>
+    </div>
+  </div>
+</nav></header>
+<main><article>
+  <div class="m-container m-container-inflatable">
+    <div class="m-row">
+      <div class="m-col-l-10 m-push-l-1">
+        <h1>
+          warnings
+        </h1>
+<p>This file doesn&#x27;t exist:</p><div class="m-graph"><svg style="width: 0.500rem; height: 0.500rem;" viewBox="0.00 0.00 8.00 8.00">
+<g transform="scale(1 1) rotate(0) translate(4 4)">
+</g>
+</svg>
+</div>
+      </div>
+    </div>
+  </div>
+</article></main>
+</body>
+</html>
index 5215edf8ebeeae66583ac2d73a58d4bbf9e80be8..58467601fe1bb31ac533c354610156c572b939a1 100644 (file)
@@ -423,10 +423,25 @@ class Dot(IntegrationTestCase):
 
         self.assertEqual(*self.actual_expected_contents('index.html', file))
 
+    @unittest.skipUnless(LooseVersion(doxygen_version()) >= LooseVersion("1.8.16"),
+        "1.8.16+ drops the whole <dotfile> tag if the file doesn't exist, which is incredibly dumb")
     def test_warnings(self):
+        # No warnings should be produced here
+        # TODO use self.assertNoLongs() on 3.10+
         self.run_doxygen(wildcard='warnings.xml')
         self.assertEqual(*self.actual_expected_contents('warnings.html'))
 
+    @unittest.skipUnless(LooseVersion(doxygen_version()) < LooseVersion("1.8.16"),
+        "1.8.16+ drops the whole <dotfile> tag if the file doesn't exist, which is incredibly dumb")
+    def test_warnings_1815(self):
+        with self.assertLogs() as cm:
+            self.run_doxygen(wildcard='warnings.xml')
+
+        self.assertEqual(*self.actual_expected_contents('warnings.html', 'warnings_1815.html'))
+        self.assertEqual(cm.output, [
+            "WARNING:warnings.xml: file passed to @dotfile was not found, rendering an empty graph"
+        ])
+
 class HtmlonlyHtmlinclude(IntegrationTestCase):
     def test_htmlinclude(self):
         self.run_doxygen(wildcard='indexpage.xml')