mirror of
https://github.com/saymrwulf/uhd.git
synced 2026-05-15 21:01:26 +00:00
This adds a new Gpio helper class, which uses libgpiod under the hood instead of the deprecated sysfs GPIO access. This class provides the ability to get/set a specific GPIO, which is looked up by name.
40 lines
1.1 KiB
Python
Executable file
40 lines
1.1 KiB
Python
Executable file
#
|
|
# Copyright 2019 Ettus Research, a National Instruments Brand
|
|
#
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
#
|
|
"""
|
|
Base Test Case classes
|
|
"""
|
|
|
|
from test_utilities import on_linux, on_usrp
|
|
import unittest
|
|
|
|
class TestBase(unittest.TestCase):
|
|
"""
|
|
Base Test Case class which contains commonly required functionality
|
|
"""
|
|
def skipUnlessOnLinux():
|
|
"""
|
|
Test function decorator which skips tests unless the current
|
|
execution environment is a linux OS.
|
|
"""
|
|
if on_linux():
|
|
return lambda func: func
|
|
return unittest.skip("This test is only valid when run on a Linux system.")
|
|
|
|
def skipUnlessOnUsrp():
|
|
"""
|
|
Test function decorator which skips tests unless the current
|
|
execution environment is a USRP.
|
|
"""
|
|
if on_usrp():
|
|
return lambda func: func
|
|
return unittest.skip("This test is only valid when run on the USRP.")
|
|
|
|
def set_device_name(self, device_name):
|
|
"""
|
|
Stores a device name attribute for tests whose success condition
|
|
depends on the current device.
|
|
"""
|
|
self.device_name = device_name
|