Skip to content

Commit

Permalink
nidaqmx: Fix installation with Python 3.13 (#645)
Browse files Browse the repository at this point in the history
* tests: Fix OverflowError: Python integer 36767 out of bounds for int16

* tests: Skip more examples

* nidaqmx: Update dependency versions for Python 3.13 support

* Update poetry.lock

* GitHub: Enable unit tests on Python 3.13

* tests: Reformat with black

* tests: Fix E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`

* nidaqmx: Allow newer types-protobuf

* nidaqmx: Update poetry.lock
  • Loading branch information
bkeryan authored Oct 16, 2024
1 parent 41cb6ba commit ee791a3
Show file tree
Hide file tree
Showing 7 changed files with 956 additions and 734 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
# Fail-fast skews the pass/fail ratio and seems to make pytest produce
# incomplete JUnit XML results.
fail-fast: false
Expand Down
1,663 changes: 940 additions & 723 deletions poetry.lock

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ python = "^3.8"
numpy = [
{version = ">=1.22", python = ">=3.8,<3.12"},
{version = ">=1.26", python = ">=3.12,<3.13"},
{version = ">=2.1", python = "^3.13"},
]
deprecation = ">=2.1"
# Documentation, must be in main dependencies (but optional) list for
Expand All @@ -43,7 +44,7 @@ deprecation = ">=2.1"
Sphinx = {version=">=5.0", optional=true}
sphinx_rtd_theme = {version=">=1.0", optional=true}
grpcio = {version=">=1.49.0,<2.0", optional=true}
protobuf = {version="^4.21", optional=true}
protobuf = {version=">=4.21", optional=true}
hightime = "^0.2.2"
toml = {version=">=0.10.2", optional=true}
tzlocal = "^5.0"
Expand All @@ -62,7 +63,8 @@ click = "^8.1"
Mako = "^1.2"
grpcio-tools = [
{version = "1.49.1", python = ">=3.8,<3.12"},
{version = "1.59.0", python = "^3.12"},
{version = "1.59.0", python = ">=3.12,<3.13"},
{version = "1.67.0", python = "^3.13"},
]
mypy-protobuf = ">=3.4"

Expand All @@ -78,7 +80,7 @@ nptdms = ">=1.9.0"
bandit = { version = ">=1.7", extras = ["toml"] }
ni-python-styleguide = ">=0.4.1"
mypy = ">=1.0"
types-protobuf = "^4.21"
types-protobuf = ">=4.21"
types-requests = ">=2.25.0"
grpc-stubs = "^1.53"

Expand Down
7 changes: 5 additions & 2 deletions tests/acceptance/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ def test___shipping_example___run___no_errors(example_path: Path, system):
pytest.skip(
f"Device {device_name} does not have physical channel {physical_channel_name}"
)
if example_path.name == "read_pulse_freq.py":
if example_path.name in ["read_freq.py", "read_pulse_freq.py"]:
pytest.skip("Example times out if there is no signal.")
if example_path.name == "voltage_acq_int_clk_dig_start_ref.py":
if example_path.name in [
"voltage_acq_int_clk_dig_start_ref.py",
"voltage_acq_int_clk_dig_ref.py",
]:
pytest.skip("Example times out if there is no trigger signal.")
if re.search(r"\binput\(|\bKeyboardInterrupt\b", example_source):
pytest.skip("Example waits for keyboard input.")
Expand Down
4 changes: 2 additions & 2 deletions tests/component/system/test_device_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def test___module___get_chassis___shared_interpreter(device: Device):
def test___ext_cal_last_date_and_time___no_errors(real_x_series_device: Device) -> None:
last_date_and_time = real_x_series_device.ext_cal_last_date_and_time

assert type(last_date_and_time) == datetime
assert type(last_date_and_time) is datetime
assert last_date_and_time.year > 2009
assert last_date_and_time.month >= 1
assert last_date_and_time.day > 0
Expand All @@ -126,7 +126,7 @@ def test___ext_cal_last_date_and_time___no_errors(real_x_series_device: Device)
def test___self_cal_last_date_and_time___no_errors(real_x_series_device: Device) -> None:
last_date_and_time = real_x_series_device.self_cal_last_date_and_time

assert type(last_date_and_time) == datetime
assert type(last_date_and_time) is datetime
assert last_date_and_time.year > 2009
assert last_date_and_time.month >= 1
assert last_date_and_time.day > 0
Expand Down
4 changes: 2 additions & 2 deletions tests/component/task/test_in_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
SINE_VOLTAGE_MIN = -2.5
SINE_RAW_MAX = 16383
SINE_RAW_MIN = -16384
FULLSCALE_RAW_MAX = 36767
FULLSCALE_RAW_MIN = -36768
FULLSCALE_RAW_MAX = 32767
FULLSCALE_RAW_MIN = -32768


@pytest.fixture()
Expand Down
2 changes: 1 addition & 1 deletion tests/component/test_task_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ def test___event_callback_that_raises_exceptions___run_finite_acquisition___exce


def _exception_matches(e1: BaseException, e2: BaseException) -> bool:
return type(e1) == type(e2) and e1.args == e2.args
return type(e1) is type(e2) and e1.args == e2.args


def _get_exception(record: LogRecord) -> BaseException:
Expand Down

0 comments on commit ee791a3

Please sign in to comment.