This repository has been archived on 2024-12-03. You can view files and clone it, but cannot push or open issues or pull requests.
PyBitmessage-2024-12-03/src/tests/partial.py

42 lines
1.1 KiB
Python
Raw Normal View History

"""A test case for partial run class definition"""
import os
import sys
import unittest
from pybitmessage import pathmagic
class TestPartialRun(unittest.TestCase):
"""
A base class for test cases running some parts of the app,
e.g. separate threads or packages.
"""
@classmethod
def setUpClass(cls):
# pylint: disable=import-outside-toplevel,unused-import
cls.dirs = (os.path.abspath(os.curdir), pathmagic.setup())
import bmconfigparser
import state
from debug import logger # noqa:F401 pylint: disable=unused-variable
if sys.hexversion >= 0x3000000:
# pylint: disable=no-name-in-module,relative-import
2024-03-22 09:52:02 +01:00
from mockbm import network as network_mock
import network
network.stats = network_mock.stats
state.shutdown = 0
cls.state = state
bmconfigparser.config = cls.config = bmconfigparser.BMConfigParser()
cls.config.read()
@classmethod
def tearDownClass(cls):
cls.state.shutdown = 1
# deactivate pathmagic
os.chdir(cls.dirs[0])
sys.path.remove(cls.dirs[1])