Skip to content

Commit

Permalink
CI: Update tests to match new filemodes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadgetoid committed Jun 17, 2024
1 parent 2a3f7e6 commit 7dcef91
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/test_gpio.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
def test_setup_rpio(gpio, patch_open):
gpio.setup(10, gpio.OUT)

patch_open.assert_any_call("/sys/class/gpio/export", "w+")
patch_open.assert_any_call("/sys/class/gpio/export", gpio.FMODE_SYS_WO)
patch_open().__enter__().write.assert_any_call("10")

patch_open.assert_any_call("/sys/class/gpio/gpio10/value", "wb+", buffering=0)
patch_open.assert_any_call("/sys/class/gpio/gpio10/direction", "w+")
patch_open.assert_any_call("/sys/class/gpio/gpio10/value", gpio.FMODE_BIN_RW, buffering=0)
patch_open.assert_any_call("/sys/class/gpio/gpio10/direction", gpio.FMODE_SYS_RW)
patch_open().__enter__().write.assert_any_call(str(gpio.OUT))


def test_setup_class(gpio, patch_open):
_ = gpio.GPIOPin(10, gpio.OUT)

patch_open.assert_any_call("/sys/class/gpio/export", "w+")
patch_open.assert_any_call("/sys/class/gpio/export", gpio.FMODE_SYS_WO)
patch_open().__enter__().write.assert_any_call("10")

patch_open.assert_any_call("/sys/class/gpio/gpio10/value", "wb+", buffering=0)
patch_open.assert_any_call("/sys/class/gpio/gpio10/direction", "w+")
patch_open.assert_any_call("/sys/class/gpio/gpio10/value", gpio.FMODE_BIN_RW, buffering=0)
patch_open.assert_any_call("/sys/class/gpio/gpio10/direction", gpio.FMODE_SYS_RW)
patch_open().__enter__().write.assert_any_call(str(gpio.OUT))


Expand Down Expand Up @@ -99,7 +99,7 @@ def test_cleanup_class_unexports_pin(gpio, patch_open):
pin.root = "/dev/null" # Pass os.path.exists check
pin.cleanup()

patch_open.assert_any_call("/sys/class/gpio/unexport", "w+")
patch_open.assert_any_call("/sys/class/gpio/unexport", gpio.FMODE_SYS_WO)
patch_open().__enter__().write.assert_any_call("10")


Expand Down

0 comments on commit 7dcef91

Please sign in to comment.