Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/python_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ on:
pull_request:
paths:
- '.github/workflows/python_tests.yml'
- 'tools/logunitas/**'
- 'bin/**'
- 'p1_runner/**'
- 'tests/**'
- 'requirements*.txt'
push:
branches:
- 'st-develop'
- 'internal'
paths:
- '.github/workflows/python_tests.yml'
- 'tools/logunitas/**'
- 'bin/**'
- 'p1_runner/**'
- 'tests/**'
- 'requirements*.txt'

jobs:
test:
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<table>
<tr><td>Build Status</td><td><img src="https://img.shields.io/github/actions/workflow/status/PointOneNav/p1-host-tools/release.yml?label=Build+Status"/></td></tr>
<tr><td>Python Support</td><td><img src="https://img.shields.io/github/actions/workflow/status/PointOneNav/p1-host-tools/python_tests.yml?job=Python+Tests+(3.8)&label=3.8"/> <img src="https://img.shields.io/github/actions/workflow/status/PointOneNav/p1-host-tools/python_tests.yml?job=Python+Tests+(3.9)&label=3.9"/> <img src="https://img.shields.io/github/actions/workflow/status/PointOneNav/p1-host-tools/python_tests.yml?job=Python+Tests+(3.10)&label=3.10"/> <img src="https://img.shields.io/github/actions/workflow/status/PointOneNav/p1-host-tools/python_tests.yml?job=Python+Tests+(3.11)&label=3.11"/> <img src="https://img.shields.io/github/actions/workflow/status/PointOneNav/p1-host-tools/python_tests.yml?job=Python+Tests+(3.12)&label=3.12"/> <img src="https://img.shields.io/github/actions/workflow/status/PointOneNav/p1-host-tools/python_tests.yml?job=Python+Tests+(3.13)&label=3.13"/></td></tr>
</table>

# Point One Host Tools <!-- omit from toc -->
Tools for interfacing with Point One FusionEngine devices from a host computer. These tools are compatible with Windows, macOS, and Linux.

Expand Down
26 changes: 26 additions & 0 deletions tests/test_syntax_compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""!
@brief Verify that user scripts compile cleanly on the current Python interpreter.

Note that this only checks that the syntax is valid for the supported Python versions (e.g. match statements, X | Y
union types, walrus operator, etc.). It does not test that the code actually functions as intended.
"""

import glob
import os
import py_compile
import pytest

_REPO_ROOT = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))

_SCRIPTS = sorted(
p for p in (
glob.glob(os.path.join(_REPO_ROOT, 'bin', '**', '*.py'), recursive=True) +
glob.glob(os.path.join(_REPO_ROOT, 'p1_runner', '**', '*.py'), recursive=True)
)
if '__pycache__' not in p
)

# Parametrize by repo-relative path for readable test IDs.
@pytest.mark.parametrize('path', _SCRIPTS, ids=[os.path.relpath(p, _REPO_ROOT) for p in _SCRIPTS])
def test_compiles(path):
py_compile.compile(path, doraise=True)
Loading