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 Dec 31, 2023
1 parent 0fd5b63 commit 78642b5
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 @@ -9,6 +9,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 @@ -18,6 +22,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 @@ -49,23 +60,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 78642b5

Please sign in to comment.