Skip to content

Commit

Permalink
Add unit test for setup with args
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianPugh committed Mar 13, 2023
1 parent fceaa2e commit 2f2865b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/integration/test_function_decorators.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest

import belay
from belay import Device


def test_setup_basic(emulated_device):
Expand Down Expand Up @@ -77,3 +78,24 @@ def foo():
emulated_device.close()

mock_teardown.assert_called_once()


def test_classdecorator_setup():
@Device.setup
def foo1():
pass

@Device.setup()
def foo2():
pass

@Device.setup(autoinit=True)
def foo3():
pass

with pytest.raises(ValueError):
# Provided an arg with autoinit=True is not allowed.

@Device.setup(autoinit=True)
def foo(arg1=1):
pass

0 comments on commit 2f2865b

Please sign in to comment.