upytester.pyboard.utils package

Submodules

upytester.pyboard.utils.exceptions module

exception upytester.pyboard.utils.exceptions.DeviceFileNotFoundError

Bases: Exception

Raised if the device-file associated with a pyboard could not be found

exception upytester.pyboard.utils.exceptions.PyBoardNotFoundError

Bases: Exception

Raised if the requested board could not be found

upytester.pyboard.utils.utils_linux module

class upytester.pyboard.utils.utils_linux.Flash

Bases: upytester.pyboard.utils.utils_linux.StorageDevice

DEVICE_FILE_PREFIX = 'Flash'
DEVICE_MARKER_FILE = '.pyboard-flash'
class upytester.pyboard.utils.utils_linux.SDCard

Bases: upytester.pyboard.utils.utils_linux.StorageDevice

DEVICE_FILE_PREFIX = 'SD_card'
DEVICE_MARKER_FILE = '.pyboard-sd'
class upytester.pyboard.utils.utils_linux.StorageDevice

Bases: object

DEVICE_FILE_PREFIX = None
DEVICE_MARKER_FILE = None
classmethod find_device_file(pyboard, suffix='-part1')
classmethod find_mountpoint(pyboard)

Find the mountpoint of the given pyboard

classmethod get_udisksctl_info(pyboard)
classmethod mount(pyboard)

Mount the PyBoard’s storage medium, and return the mounted folder

classmethod sync_files_to_device(source_path, pyboard, subdir='.', force=False, dryrun=False, quiet=False, exclude=[])

Synchronise a filesystem to the pyboard’s storage. Used to deploy code onto a test bench

Parameters
  • source_path (str) – Source folder to sync with SD card

  • pyboard (upytester.PyBoard) – PyBoard to sync to

  • subdir (str) – Subdirectory on pyboard to sync to

  • force (bool) – If True, assertion of the pre-existence of placeholder files will be ignored.

  • dryrun (bool) – If True, sync will not be performed, but everything else will be done. Use to manually confirm folder sync if you’re concerned about what it’ll do.

  • quiet (bool) – If True process will not print anything to stdout

  • exclude (list of str) – List of file patterns of files to ignore during sync operation

classmethod unmount(pyboard)

Unmount SD card (if mounted)

upytester.pyboard.utils.utils_linux.connected_serial_numbers()

Finds all pyboards connected via USB, and returns a list of their serial numbers.

Return type

list of str

upytester.pyboard.utils.utils_linux.find_mountpoint_flash(*args, **kwargs)
upytester.pyboard.utils.utils_linux.find_mountpoint_sd(*args, **kwargs)
upytester.pyboard.utils.utils_linux.find_portinfo(pyboard)

Finds the comport associated with the given PyBoard.

Parameters

pyboard (pyboard.PyBoard) – The connected device in question

Returns

information container class for a single serial port, or None

Return type

serial.tools.list_ports_common.ListPortInfo

upytester.pyboard.utils.utils_linux.mount_flash(*args, **kwargs)
upytester.pyboard.utils.utils_linux.mount_sd(*args, **kwargs)
upytester.pyboard.utils.utils_linux.sync_files_to_flash(*args, **kwargs)
upytester.pyboard.utils.utils_linux.sync_files_to_sd(*args, **kwargs)
upytester.pyboard.utils.utils_linux.unmount_flash(*args, **kwargs)
upytester.pyboard.utils.utils_linux.unmount_sd(*args, **kwargs)

upytester.pyboard.utils.utils_win32 module

Module contents

upytester.pyboard.utils.connected_serial_numbers()

Finds all pyboards connected via USB, and returns a list of their serial numbers.

Return type

list of str

upytester.pyboard.utils.find_portinfo(pyboard)

Finds the comport associated with the given PyBoard.

Parameters

pyboard (pyboard.PyBoard) – The connected device in question

Returns

information container class for a single serial port, or None

Return type

serial.tools.list_ports_common.ListPortInfo

upytester.pyboard.utils.find_mountpoint_sd(*args, **kwargs)
upytester.pyboard.utils.mount_sd(*args, **kwargs)
upytester.pyboard.utils.unmount_sd(*args, **kwargs)
upytester.pyboard.utils.sync_files_to_sd(*args, **kwargs)
upytester.pyboard.utils.find_mountpoint_flash(*args, **kwargs)
upytester.pyboard.utils.mount_flash(*args, **kwargs)
upytester.pyboard.utils.unmount_flash(*args, **kwargs)
upytester.pyboard.utils.sync_files_to_flash(*args, **kwargs)