diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3d3e6d..f6581c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,33 @@ env: PY_COLORS: "1" jobs: + test: + runs-on: windows-latest + strategy: + matrix: + python-version: [ + "3.8", + "3.9", + "3.10", + "3.11", + "3.12", + ] + fail-fast: false + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install pytest + python -m pip install . + - name: Test + run: | + python -m pytest -v --assert=plain ./tests + mypy: runs-on: windows-latest steps: diff --git a/pyproject.toml b/pyproject.toml index 895318b..5da3be3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -89,7 +89,7 @@ select = [ "I", # isort "ISC", # flake8-implicit-str-concat "PIE", # flake8-pie - "PL", + "PL", # pylint "RSE", # flake8-raise "RUF", # Ruff-specific rules "S", # flake8-bandit @@ -105,5 +105,12 @@ ignore = [ "RUF012", # mutable-class-default ] +[tool.ruff.per-file-ignores] +"tests/**/*.py" = [ + "S101", # asserts allowed in tests... + "ARG", # Unused function args -> fixtures nevertheless are functionally relevant + "PLR2004", # Magic value used in comparison +] + [tool.ruff.isort] known-first-party = ["pycanape"] diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_api.py b/tests/test_api.py new file mode 100644 index 0000000..4b7a9c3 --- /dev/null +++ b/tests/test_api.py @@ -0,0 +1,46 @@ +import pycanape + + +def test_toplevel_attributes() -> None: + assert hasattr(pycanape, "__version__") + assert hasattr(pycanape, "cnp_api") + assert hasattr(pycanape, "calibration_object") + assert hasattr(pycanape, "canape") + assert hasattr(pycanape, "config") + assert hasattr(pycanape, "daq") + assert hasattr(pycanape, "ecu_task") + assert hasattr(pycanape, "get_canape_data_path") + assert hasattr(pycanape, "get_canape_dll_path") + assert hasattr(pycanape, "get_canape_path") + assert hasattr(pycanape, "get_canape_versions") + assert hasattr(pycanape, "module") + assert hasattr(pycanape, "recorder") + assert hasattr(pycanape, "script") + assert hasattr(pycanape, "utils") + assert hasattr(pycanape, "AsciiCalibrationObject") + assert hasattr(pycanape, "AxisCalibrationObject") + assert hasattr(pycanape, "CANapeDll") + assert hasattr(pycanape, "CANapeVersion") + assert hasattr(pycanape, "CurveCalibrationObject") + assert hasattr(pycanape, "MapCalibrationObject") + assert hasattr(pycanape, "ScalarCalibrationObject") + assert hasattr(pycanape, "ValueBlockCalibrationObject") + assert hasattr(pycanape, "AppVersion") + assert hasattr(pycanape, "CANape") + assert hasattr(pycanape, "Channels") + assert hasattr(pycanape, "DriverType") + assert hasattr(pycanape, "EventCode") + assert hasattr(pycanape, "MeasurementState") + assert hasattr(pycanape, "ObjectType") + assert hasattr(pycanape, "RecorderState") + assert hasattr(pycanape, "RecorderType") + assert hasattr(pycanape, "ValueType") + assert hasattr(pycanape, "RC") + assert hasattr(pycanape, "FifoReader") + assert hasattr(pycanape, "DatabaseInfo") + assert hasattr(pycanape, "EcuTask") + assert hasattr(pycanape, "MeasurementListEntry") + assert hasattr(pycanape, "Module") + assert hasattr(pycanape, "Recorder") + assert hasattr(pycanape, "Script") + assert hasattr(pycanape, "CANapeError")