From 679ff20f947d9fa552a273b6da548f808a765fd0 Mon Sep 17 00:00:00 2001 From: Christian Manivong Date: Wed, 11 Nov 2026 15:43:27 +0100 Subject: [PATCH] fix(tests): import the test helpers by their own name textfsm 2.1.1 (2026-11-10, through napalm) installs a top-level package "tests" into site-packages. It shadows this repo's tests directory, which is no package, so "from tests.conftest import ..." found textfsm's and test_bmc_driver.py and test_x10_redfish.py failed to import: every test run on CI fails since that release, main included. The helpers are imported as conftest and test_ipmi, the way test_driver.py already does; pytest puts tests/ on the path for them. --- pyproject.toml | 3 ++- tests/test_bmc_driver.py | 4 ++-- tests/test_time_sync.py | 2 +- tests/test_x10_redfish.py | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1344369..78dd549 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -80,7 +80,8 @@ ignore_errors = true [tool.pytest.ini_options] testpaths = ["tests"] -# The tests import their helpers as tests.conftest, also under a bare pytest. +# The tests import their helpers by their own name (conftest, test_ipmi): a package +# "tests" may come with a dependency (textfsm 2.1.1 ships one). pythonpath = ["."] [tool.coverage.run] diff --git a/tests/test_bmc_driver.py b/tests/test_bmc_driver.py index c06adb5..0a55433 100644 --- a/tests/test_bmc_driver.py +++ b/tests/test_bmc_driver.py @@ -12,13 +12,13 @@ import json from pathlib import Path import pytest +from conftest import BASE_URL, FIXTURES, MockupServer from napalm_device_types import ManagementControllerDriver from napalm_device_types.roles import primary_role_of +from test_ipmi import FakeCommand import napalm_redfish.ipmi as ipmi from napalm_redfish.bmc import BmcDriver -from tests.conftest import BASE_URL, FIXTURES, MockupServer -from tests.test_ipmi import FakeCommand X10 = Path(__file__).parent / "fixtures" / "supermicro-x10drl-i-3.91" MOCKUP = "supermicro-x10drl-i-3.91/redfish" diff --git a/tests/test_time_sync.py b/tests/test_time_sync.py index ad0075c..fc32780 100644 --- a/tests/test_time_sync.py +++ b/tests/test_time_sync.py @@ -201,7 +201,7 @@ def test_the_zone_is_refused(driver): @pytest.fixture def bmc_driver(server, monkeypatch): - from tests.test_ipmi import FakeCommand + from test_ipmi import FakeCommand FakeCommand.instances = [] monkeypatch.setattr(ipmi, "Command", FakeCommand) diff --git a/tests/test_x10_redfish.py b/tests/test_x10_redfish.py index 31c7c5c..9807c16 100644 --- a/tests/test_x10_redfish.py +++ b/tests/test_x10_redfish.py @@ -10,10 +10,10 @@ files hold the error body the BMC sent. import json import pytest +from conftest import BASE_URL, FIXTURES, MockupServer from napalm_device_types import models from napalm_redfish import RedfishDriver -from tests.conftest import BASE_URL, FIXTURES, MockupServer MOCKUP = "supermicro-x10drl-i-3.91/redfish" REFUSED = json.loads((FIXTURES / MOCKUP / "STATUS.json").read_text())