Skip to content

Commit

Permalink
added some lint to tests/conftest.py
Browse files Browse the repository at this point in the history
  • Loading branch information
qlrd committed Jan 5, 2024
1 parent 8a02cfa commit 4a2f3f0
Showing 1 changed file with 38 additions and 3 deletions.
41 changes: 38 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@


def reset_krux_modules():
"""
Delete all related krux modules that
the current shell has imported
"""
import sys

for name in list(sys.modules.keys()):
Expand All @@ -19,6 +23,13 @@ def reset_krux_modules():

@pytest.fixture
def mp_modules(mocker, monkeypatch):
"""
Suppress the default behavior of some modules
without changing its original source code.
:param mocker: the mocker
:param monkeypatch: the monkey patcher
"""
from embit.util import secp256k1
import random
import time
Expand Down Expand Up @@ -50,23 +61,47 @@ def mp_modules(mocker, monkeypatch):


@pytest.fixture
def m5stickv(monkeypatch, mp_modules):
# pylint: disable=unused-argument
def m5stickv(monkeypatch, mp_modules): # pylint: disable=redefined-outer-name
"""
Suppress the default behavior of :module:`board`
for m5stickV device
:param monkeypatch: the monkey patcher
:param mp_modules: the mp_modules function
"""
import sys

monkeypatch.setitem(sys.modules, "board", board_m5stickv())
reset_krux_modules()


@pytest.fixture
def amigo_tft(monkeypatch, mp_modules):
# pylint: disable=unused-argument
def amigo_tft(monkeypatch, mp_modules): # pylint: disable=redefined-outer-name
"""
Suppress the default behavior of :module:`board`
for amigo_tft device
:param monkeypatch: the monkey patcher
:param mp_modules: the mp_modules function
"""
import sys

monkeypatch.setitem(sys.modules, "board", board_amigo_tft())
reset_krux_modules()


@pytest.fixture
def dock(monkeypatch, mp_modules):
# pylint: disable=unused-argument
def dock(monkeypatch, mp_modules): # pylint: disable=redefined-outer-name
"""
Suppress the default behavior of :module:`board`
for dock device
:param monkeypatch: the monkey patcher
:param mp_modules: the mp_modules function
"""
import sys

monkeypatch.setitem(sys.modules, "board", board_dock())
Expand Down

0 comments on commit 4a2f3f0

Please sign in to comment.