Skip to content
Open
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
3 changes: 2 additions & 1 deletion .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
1025e183b346ddbff343e608cb1b688098bb7c40
1025e183b346ddbff343e608cb1b688098bb7c40
dee1f81b51e64591cff3b0cffea4f56975b9c91d
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ jobs:
- name: Run tests with tox
run: |
tox -e py
- name: Check formatting
- name: Check formatting with pre-commit
run: |
tox -e black
tox -e pre-commit
- name: Run mypy with tox
run: |
tox -e mypy
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ repos:
hooks:
- id: check-yaml
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 26.5.1
hooks:
- id: black
1 change: 1 addition & 0 deletions examples/function_generator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Examples on how to use the function generator driver
"""

import time

from fixate.core.common import TestClass, TestList
Expand Down
1 change: 1 addition & 0 deletions examples/jig_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This file is just a test playground that shows how the update jig classes will
fit together.
"""

from __future__ import annotations
from dataclasses import dataclass, field
from fixate import (
Expand Down
1 change: 1 addition & 0 deletions examples/programmable_power_supply.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Examples on how to use the programmable power supply driver works
"""

import time

from fixate.core.common import TestClass, TestList
Expand Down
1 change: 1 addition & 0 deletions examples/test_script.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This is a test script that shows basic use case for the fixate library
"""

from fixate.core.common import TestClass, TestList
from fixate.core.checks import *
from fixate.core.ui import *
Expand Down
1 change: 1 addition & 0 deletions src/fixate/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Drivers are hard coded into the config to prevent issues arising from auto discovery
Must ensure driver imports are infallible to prevent program crash on start
"""

from fixate.config.helper import (
load_dict_config,
load_yaml_config,
Expand Down
1 change: 1 addition & 0 deletions src/fixate/core/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This module is used to allow for tests to test values against criteria.
It should implement necessary logging functions and report success or failure.
"""

from dataclasses import dataclass, field
from typing import Any, Callable, Iterable, Optional
import logging
Expand Down
1 change: 1 addition & 0 deletions src/fixate/core/ui.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This module details user input api
"""

import time
from queue import Queue, Empty
from pubsub import pub
Expand Down
2 changes: 1 addition & 1 deletion src/fixate/drivers/_ftdi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Private wrapper for ftdi driver. DLL on Windows, .so shared library on *nix.
"""Private wrapper for ftdi driver. DLL on Windows, .so shared library on *nix.
This is wrapped privately so it can be ommitted from the documentation build.
"""

Expand Down
2 changes: 1 addition & 1 deletion src/fixate/drivers/daq/daqmx.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
C:\Program Files\National Instruments\NI-DAQ\DAQmx ANSI C Dev\include\NIDAQmx.h
"""

from collections import namedtuple
from fixate.core.common import ExcThread
from queue import Queue, Empty

from ctypes import byref, c_char_p
import numpy


# Basic Functions
from PyDAQmx import (
DAQmxResetDevice,
Expand Down
2 changes: 1 addition & 1 deletion src/fixate/drivers/dcload/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
DC ELectronic Load driver
=========================
=========================
Use `DCLoad.open()` to connect to a DC electronic load.
Functions are dictated by the abstract superclass ``DCLoad`` in helper.py
Expand Down
3 changes: 1 addition & 2 deletions src/fixate/drivers/dcload/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ class DCLoad(DriverProtocol, Protocol):

REGEX_ID: str

def __init__(self, instrument) -> None:
...
def __init__(self, instrument) -> None: ...

def reset(self) -> None:
"""Reset the instrument to a known state."""
Expand Down
1 change: 1 addition & 0 deletions src/fixate/drivers/dmm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
dmm.measure(*mode, **mode_params)
dmm.reset()
"""

import pyvisa

import fixate.drivers
Expand Down
1 change: 0 additions & 1 deletion src/fixate/drivers/dso/agilent_mso_x.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from fixate.drivers.dso.helper import DSO
import time


# Example IDN Strings
# KEYSIGHT TECHNOLOGIES,DSOX1202G,CN60074190,02.10.2019111333
# KEYSIGHT TECHNOLOGIES,DSO-X 1102G,CN57096441,01.20.2019061038
Expand Down
1 change: 1 addition & 0 deletions src/fixate/drivers/funcgen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
output_ch3
output_ch4
"""

import pyvisa

import fixate.drivers
Expand Down
1 change: 1 addition & 0 deletions src/fixate/drivers/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This module implements concrete AddressHandler type, that
can be used to implement IO for the fixate.core.switching module.
"""

from __future__ import annotations

from typing import Sequence, Optional
Expand Down
1 change: 1 addition & 0 deletions src/fixate/drivers/lcr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Functions are dictated by the metaclass in helper.py
"""

import pyvisa

import fixate.drivers
Expand Down
6 changes: 3 additions & 3 deletions src/fixate/drivers/pps/bk_178x.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ def _packet_encode(self, command, *data_tuples):
packet[2] = command
packet_index = 3
for data, num_bytes in data_tuples:
packet[
packet_index : packet_index + num_bytes
] = self._little_endian_encode(data)[0:num_bytes]
packet[packet_index : packet_index + num_bytes] = (
self._little_endian_encode(data)[0:num_bytes]
)
packet_index += num_bytes
if packet_index >= self.PACKET_LENGTH:
raise ValueError("Too many bytes to pack into packet")
Expand Down
1 change: 0 additions & 1 deletion src/fixate/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from fixate.ui_cmdline import register_cmd_line, unregister_cmd_line
import fixate.sequencer


logger = logging.getLogger(__name__)


Expand Down
1 change: 1 addition & 0 deletions src/fixate/reporting/csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
Test End
<Time Elapsed (s)>,Test <index>,end,<PASS FAIL ERROR>,checks-passed=<passed>,checks-failed<failed>,checks-error=<errors>
"""

import csv
import datetime
import sys
Expand Down
4 changes: 2 additions & 2 deletions src/fixate/ui_cmdline/kbhit.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
with IDLE.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
Expand Down
1 change: 0 additions & 1 deletion test/core/test_config_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from fixate.core import config_util
from fixate import config


# Ideally these tests would be done with the cmd2 test plugin (https://pypi.org/project/cmd2-ext-test/)
# by the people who made CMD2, however it have proved to be more work than it is worth.
# So the tests will focus on the internal methods of the FxConfigCmd class.
Expand Down
1 change: 0 additions & 1 deletion test/drivers/test_ftdi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from fixate.core.exceptions import *
from fixate.config import load_config


load_config() # Load fixate config file


Expand Down
4 changes: 1 addition & 3 deletions test/drivers/test_keysight_DSOX1102G.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,9 +515,7 @@ def test_measure_vrms_dc_cycle(dso, funcgen, rm):
dso.stop()
funcgen.channel1(False)

assert measured_vrms_cycle == pytest.approx(
(vrms**2 + offset**2) ** 0.5, abs=0.05
)
assert measured_vrms_cycle == pytest.approx((vrms**2 + offset**2) ** 0.5, abs=0.05)


@pytest.mark.drivertest
Expand Down
10 changes: 6 additions & 4 deletions test/drivers/test_rigol_dl3021.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ def test_enable_load(dcload: RigolDL3021):
)
def test_set_mode(
dcload: RigolDL3021,
mode: Literal["constant_current"]
| Literal["constant_voltage"]
| Literal["constant_resistance"]
| Literal["constant_power"],
mode: (
Literal["constant_current"]
| Literal["constant_voltage"]
| Literal["constant_resistance"]
| Literal["constant_power"]
),
expected: Literal["CC"] | Literal["CV"] | Literal["CR"] | Literal["CP"],
):
"""Verify that set_mode correctly sets the instrument mode."""
Expand Down
1 change: 1 addition & 0 deletions test/manual/test_serial_numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Make sure local_config.json has been configured to include the required instruments
"""

from pubsub import pub
from fixate.drivers import dmm, lcr, dso, funcgen, pps
import time
Expand Down
13 changes: 6 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py312,py313,black,mypy
envlist = py312,py313,pre-commit,mypy
isolated_build = True

[testenv]
Expand All @@ -13,12 +13,6 @@ deps = build
commands =
python -m build .

[testenv:black]
basepython = python3
skip_install = true
deps = black==22.3.0
commands = black --check src test scripts {posargs}

[pytest]
# https://docs.pytest.org/en/stable/deprecations.html#junit-family-default-value-change-to-xunit2
junit_family=xunit2
Expand All @@ -28,6 +22,11 @@ addopts = --ignore=test/manual
markers =
drivertest : Fixate driver test

[testenv:pre-commit]
basepython = python3
deps = pre-commit==4.6.0
commands = pre-commit run --all-files

[testenv:mypy]
basepython = python3
deps = mypy==1.10.0
Expand Down
Loading