-
Notifications
You must be signed in to change notification settings - Fork 20
/
conftest.py
31 lines (25 loc) · 894 Bytes
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#
# (c) Copyright 2022 by Coinkite Inc. This file is covered by license found in COPYING-CC.
#
import pytest
def pytest_addoption(parser):
parser.addoption("--cvc", action="store", type=str,
default=None, help="CVC for card under test")
@pytest.fixture(scope='session')
def dev():
# a connected card (via USB to NFC reader) .. or the emulator
# use command line flag to pick device/emulation method
from cktap.transport import CKTapCard, find_cards
for c in find_cards():
assert isinstance(c, CKTapCard)
return c
else:
raise pytest.fail('no card / emulator found')
@pytest.fixture(scope='session')
def known_cvc(request):
# some tests require "--cvc 123456" arg on pytest cmd line
rv = request.config.getoption("--cvc")
if rv is None:
raise pytest.skip("need CVC for this test")
return rv
# EOF