summaryrefslogtreecommitdiffstats
path: root/docs/scripts
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2025-01-14 10:18:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2025-01-14 10:18:29 +0000
commit6818d016122ee845a2011b94bbdad0ed28a9aae7 (patch)
treee9865932680acf05b8c353347cf362ab3fd10ff0 /docs/scripts
parentReleasing debian version 1.1.0-1. (diff)
downloadanta-6818d016122ee845a2011b94bbdad0ed28a9aae7.tar.xz
anta-6818d016122ee845a2011b94bbdad0ed28a9aae7.zip
Merging upstream version 1.2.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'docs/scripts')
-rwxr-xr-xdocs/scripts/generate_examples_tests.py29
-rw-r--r--docs/scripts/generate_svg.py2
2 files changed, 30 insertions, 1 deletions
diff --git a/docs/scripts/generate_examples_tests.py b/docs/scripts/generate_examples_tests.py
new file mode 100755
index 0000000..a88d9d6
--- /dev/null
+++ b/docs/scripts/generate_examples_tests.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+# Copyright (c) 2024 Arista Networks, Inc.
+# Use of this source code is governed by the Apache License 2.0
+# that can be found in the LICENSE file.
+"""Generates examples/tests.py."""
+
+import os
+from contextlib import redirect_stdout
+from pathlib import Path
+from sys import path
+
+# Override global path to load anta from pwd instead of any installed version.
+path.insert(0, str(Path(__file__).parents[2]))
+
+examples_tests_path = Path(__file__).parents[2] / "examples" / "tests.yaml"
+
+
+prev = os.environ.get("TERM", "")
+os.environ["TERM"] = "dumb"
+# imported after TERM is set to act upon rich console.
+from anta.cli.get.commands import tests # noqa: E402
+
+with examples_tests_path.open("w") as f:
+ f.write("---\n")
+ with redirect_stdout(f):
+ # removing the style
+ tests()
+
+os.environ["TERM"] = prev
diff --git a/docs/scripts/generate_svg.py b/docs/scripts/generate_svg.py
index f017b24..2eca6ac 100644
--- a/docs/scripts/generate_svg.py
+++ b/docs/scripts/generate_svg.py
@@ -94,7 +94,7 @@ if __name__ == "__main__":
# Redirect stdout of the program towards another StringIO to capture help
# that is not part or anta rich console
# redirect potential progress bar output to console by patching
- with patch("anta.cli.nrfu.anta_progress_bar", custom_progress_bar), suppress(SystemExit):
+ with patch("anta.cli.nrfu.utils.anta_progress_bar", custom_progress_bar), suppress(SystemExit):
function()
if "--help" in args: