From a9141caafb902da4f78e4995b630c4179bd48483 Mon Sep 17 00:00:00 2001 From: "Felt, Nicholas" Date: Fri, 6 Sep 2024 09:59:40 -0700 Subject: [PATCH] test: Update tests and workflows to run properly --- .../check-api-for-breaking-changes.yml | 2 +- .gitignore | 2 +- docs/_static/css/theme_overrides.css | 4 ++-- docs/_static/js/copybutton.js | 22 +++++++++---------- docs/_static/js/insert-hr.js | 4 ++-- docs/generate_api_pages.py | 2 +- mkdocs.yml | 4 ++-- pyproject.toml | 4 ++-- tests/test_client.py | 2 +- 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/check-api-for-breaking-changes.yml b/.github/workflows/check-api-for-breaking-changes.yml index a30f90c..5ab252f 100644 --- a/.github/workflows/check-api-for-breaking-changes.yml +++ b/.github/workflows/check-api-for-breaking-changes.yml @@ -7,4 +7,4 @@ jobs: check-api-for-breaking-changes: uses: tektronix/python-package-ci-cd/.github/workflows/_reusable-check-api-for-breaking-changes.yml@v1.2.0 with: - package-name: TekHSI + package-name: tekhsi # griffe requires the package name in lowercase diff --git a/.gitignore b/.gitignore index 0468c26..7cc6815 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,7 @@ _readthedocs/ # Distribution / packaging .Python build/ develop-eggs/ -dist/ +dist*/ downloads/ eggs/ .eggs/ diff --git a/docs/_static/css/theme_overrides.css b/docs/_static/css/theme_overrides.css index 4d433e4..cdd1206 100644 --- a/docs/_static/css/theme_overrides.css +++ b/docs/_static/css/theme_overrides.css @@ -123,11 +123,11 @@ span.doc-object-name { } /* Customize link color */ -a.autorefs, a.autorefs code { +a.autorefs, a.autorefs code, .rst-content .admonition a.autorefs code { color: dodgerblue !important; } -a.autorefs:hover, a.autorefs:hover code { +a.autorefs:hover, a.autorefs:hover code, .rst-content .admonition a.autorefs:hover code { color: #d600d6 !important; } diff --git a/docs/_static/js/copybutton.js b/docs/_static/js/copybutton.js index a8c90c6..8c96aea 100644 --- a/docs/_static/js/copybutton.js +++ b/docs/_static/js/copybutton.js @@ -96,8 +96,8 @@ const clearSelection = () => { // Changes tooltip text for a moment, then changes it back // We want the timeout of our `success` class to be a bit shorter than the // tooltip and icon change, so that we can hide the icon before changing back. -var timeoutIcon = 2000; -var timeoutSuccessClass = 1500; +const timeoutIcon = 2000; +const timeoutSuccessClass = 1500; const temporarilyChangeTooltip = (el, oldText, newText) => { el.setAttribute('data-tooltip', newText) @@ -159,12 +159,12 @@ function filterText(target, exclude) { // Callback when a copy button is clicked. Will be passed the node that was clicked // should then grab the text and replace pieces of text that shouldn't be used in output function formatCopyText(textContent, copybuttonPromptText, isRegexp = false, onlyCopyPromptLines = true, removePrompts = true, copyEmptyLines = true, lineContinuationChar = "", hereDocDelim = "") { - var regexp; - var match; + let regexp; + let match; // Do we check for line continuation characters and "HERE-documents"? - var useLineCont = !!lineContinuationChar - var useHereDoc = !!hereDocDelim + let useLineCont = !!lineContinuationChar + let useHereDoc = !!hereDocDelim // create regexp to capture prompt and remaining line if (isRegexp) { @@ -174,9 +174,9 @@ function formatCopyText(textContent, copybuttonPromptText, isRegexp = false, onl } const outputLines = []; - var promptFound = false; - var gotLineCont = false; - var gotHereDoc = false; + let promptFound = false; + let gotLineCont = false; + let gotHereDoc = false; const lineGotPrompt = []; for (const line of textContent.split('\n')) { match = line.match(regexp) @@ -211,8 +211,8 @@ function formatCopyText(textContent, copybuttonPromptText, isRegexp = false, onl } -var copyTargetText = (trigger) => { - var target = document.querySelector(trigger.attributes['data-clipboard-target'].value); +const copyTargetText = (trigger) => { + let target = document.querySelector(trigger.attributes['data-clipboard-target'].value); // get filtered text let exclude = '.linenos'; // Can use ".linenos, .gp, .go" to exclude prompt characters and output in code blocks diff --git a/docs/_static/js/insert-hr.js b/docs/_static/js/insert-hr.js index a61d9b5..b941962 100644 --- a/docs/_static/js/insert-hr.js +++ b/docs/_static/js/insert-hr.js @@ -1,9 +1,9 @@ document.addEventListener('DOMContentLoaded', function () { // Selects all h2 elements within divs that have both the "doc" and "doc-children" classes - var headings = document.querySelectorAll('.doc.doc-children h2'); + let headings = document.querySelectorAll('.doc.doc-children h2'); headings.forEach(function(heading) { - var hr = document.createElement('hr'); // Creates a new
element + let hr = document.createElement('hr'); // Creates a new
element // Inserts the
element before the current h2 element heading.parentNode.insertBefore(hr, heading); }); diff --git a/docs/generate_api_pages.py b/docs/generate_api_pages.py index 201892e..ee88820 100644 --- a/docs/generate_api_pages.py +++ b/docs/generate_api_pages.py @@ -43,7 +43,7 @@ def sort_paths(path_object: Path) -> Tuple[int, str]: parts = parts[:-1] doc_path = doc_path.with_name("index.md") full_doc_path = full_doc_path.with_name("index.md") - elif parts[-1] == "__main__": + elif parts[-1] == "__main__" or parts[-1].startswith("_"): continue nav[parts] = doc_path.as_posix() diff --git a/mkdocs.yml b/mkdocs.yml index 2036524..8b4f2e2 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -3,13 +3,13 @@ site_name: TekHSI repo_url: https://github.com/tektronix/TekHSI edit_uri: '' site_author: Tektronix -# site_description: # TODO: fill in +site_description: Transfer waveforms from Tektronix Oscilloscopes using the High-Speed + Serial Interface copyright: © Copyright 2022, Tektronix strict: true site_url: !ENV [READTHEDOCS_CANONICAL_URL, null] use_directory_urls: true exclude_docs: | - _* *.py *.txt _templates/ diff --git a/pyproject.toml b/pyproject.toml index 2d2e0d7..7a72980 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -323,7 +323,7 @@ spaces_before_inline_comment = 2 overrides."tool.poetry.*".inline_arrays = false overrides."tool.pylint.*".table_keys = false -# Tox configuration +# TODO: enable --doctest-modules line [tool.tox] legacy_tox_ini = """ [tox] @@ -358,7 +358,7 @@ commands = !tests: poetry build --output=dist_{envname} !tests: twine check --strict dist_{envname}/* !tests: pre-commit run --all-files - !tests: pytest -vv --doctest-modules --doctest-report=ndiff --showlocals --junitxml={tox_root}/.results_{envname}/results_doctests.xml --self-contained-html --html={tox_root}/.results_{envname}/results_doctests.html src +# !tests: pytest -vv --doctest-modules --doctest-report=ndiff --showlocals --junitxml={tox_root}/.results_{envname}/results_doctests.xml --self-contained-html --html={tox_root}/.results_{envname}/results_doctests.html src pytest -vv -k "not test_docs" --showlocals --cov --junitxml={tox_root}/.results_{envname}/results.xml --cov-report=term --cov-report=xml:{tox_root}/.coverage_{envname}.xml --cov-report=html:{tox_root}/.results_{envname}/html --self-contained-html --html={tox_root}/.results_{envname}/results.html [testenv:tests] diff --git a/tests/test_client.py b/tests/test_client.py index 0e29f66..8b959c4 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -11,7 +11,7 @@ from tekhsi.helpers import print_with_timestamp from tekhsi.tek_hsi_connect import TekHSIConnect, AcqWaitOn from tekhsi._tek_highspeed_server_pb2 import ConnectRequest, ConnectStatus, WaveformHeader # pylint: disable=no-name-in-module -from tests.conftest import DerivedWaveform, DerivedWaveformHandler +from conftest import DerivedWaveform, DerivedWaveformHandler @pytest.mark.parametrize(