Skip to content

Commit

Permalink
tests: hil: scripts: package plugins in directories
Browse files Browse the repository at this point in the history
We were previously packaging our HIL pytest plugins as collections
of python scripts without any directory hierarchy. This meant that
every python file in the package was placed in the root of the
site_packages directory. If any other package did the same and had
names that conflicted, the files would be overwritten. For example
these two plugins both contain a file named plugin.py and both
attempt to place that file at the root of the site packages
directory. Normal practice in python is to create a directory for
each package, and that's what's done in this commit.

Signed-off-by: Sam Friedman <[email protected]>
  • Loading branch information
sam-golioth committed Feb 25, 2025
1 parent 0e88037 commit 731965f
Show file tree
Hide file tree
Showing 21 changed files with 31 additions and 37 deletions.
5 changes: 1 addition & 4 deletions tests/hil/scripts/pytest-hil/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,5 @@ classifiers = [
"Framework :: Pytest",
]

[tool.hatch.build.targets.wheel]
include = [ "*.py" ]

[project.entry-points.pytest11]
hil = "plugin"
hil = "pytest_hil.plugin"
Empty file.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from board import Board
from pytest_hil.board import Board
import subprocess

class BMPBoard(Board):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from espboard import ESPBoard
from zephyrboard import ZephyrBoard
from pytest_hil.espboard import ESPBoard
from pytest_hil.zephyrboard import ZephyrBoard

class ESP32DevKitCWROVER(ZephyrBoard, ESPBoard):
def __init__(self, *args, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import esptool

from board import Board
from pytest_hil.board import Board

class ESPBoard(Board):
def __init__(self, app_offset):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from board import Board
from espboard import ESPBoard
from pytest_hil.board import Board
from pytest_hil.espboard import ESPBoard

class ESPIDFBoard(ESPBoard):
def __init__(self, *args, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pylink

from board import Board
from pytest_hil.board import Board

class JLinkBoard(Board):
def __init__(self, chip_name):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import trio

from board import Board
from pytest_hil.board import Board


class LinuxBoard(Board):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from zephyrboard import ZephyrBoard
from jlinkboard import JLinkBoard
from pytest_hil.zephyrboard import ZephyrBoard
from pytest_hil.jlinkboard import JLinkBoard

class MIMXRT1024EVK(ZephyrBoard, JLinkBoard):
def __init__(self, *args, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import trio

from linuxboard import LinuxBoard
from zephyrboard import ZephyrBoard
from pytest_hil.linuxboard import LinuxBoard
from pytest_hil.zephyrboard import ZephyrBoard

class NativeSimBoard(ZephyrBoard, LinuxBoard):
def __init__(self, fw_image: str):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from zephyrboard import ZephyrBoard
from pytest_hil.zephyrboard import ZephyrBoard

class NCSBoard(ZephyrBoard):
async def reset(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from board import Board
from pytest_hil.board import Board
from pynrfjprog import HighLevel

class NordicBoard(Board):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from zephyrboard import ZephyrBoard
from nordicboard import NordicBoard
from pytest_hil.zephyrboard import ZephyrBoard
from pytest_hil.nordicboard import NordicBoard

class nRF52840DK(ZephyrBoard, NordicBoard):
@property
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ncsboard import NCSBoard
from nordicboard import NordicBoard
from pytest_hil.ncsboard import NCSBoard
from pytest_hil.nordicboard import NordicBoard

class nRF9160DK(NCSBoard, NordicBoard):
@property
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import pytest
import allure
import os
from espidfboard import ESPIDFBoard
from esp32_devkitc_wrover import ESP32DevKitCWROVER
from nrf52840dk import nRF52840DK
from nrf9160dk import nRF9160DK
from mimxrt1024evk import MIMXRT1024EVK
from rak5010 import RAK5010
from linuxboard import LinuxBoard
from native_sim import NativeSimBoard
from pytest_hil.espidfboard import ESPIDFBoard
from pytest_hil.esp32_devkitc_wrover import ESP32DevKitCWROVER
from pytest_hil.nrf52840dk import nRF52840DK
from pytest_hil.nrf9160dk import nRF9160DK
from pytest_hil.mimxrt1024evk import MIMXRT1024EVK
from pytest_hil.rak5010 import RAK5010
from pytest_hil.linuxboard import LinuxBoard
from pytest_hil.native_sim import NativeSimBoard

def pytest_addoption(parser):
parser.addoption("--platform", type=str,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from zephyrboard import ZephyrBoard
from bmpboard import BMPBoard
from pytest_hil.zephyrboard import ZephyrBoard
from pytest_hil.bmpboard import BMPBoard
from time import sleep

class RAK5010(ZephyrBoard, BMPBoard):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from board import Board
from pytest_hil.board import Board

class ZephyrBoard(Board):
@property
Expand Down
5 changes: 1 addition & 4 deletions tests/hil/scripts/pytest-zephyr-samples/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,5 @@ classifiers = [
"Framework :: Pytest",
]

[tool.hatch.build.targets.wheel]
include = [ "*.py" ]

[project.entry-points.pytest11]
zephyr-samples = "plugin"
zephyr-samples = "pytest_zephyr_samples.plugin"
Empty file.

0 comments on commit 731965f

Please sign in to comment.