* add unittests for mqtt.py * add mock * move test requirements into a file * fix unit tests * fix formating * initial version * fix SonarQube warning
19 lines
442 B
Python
19 lines
442 B
Python
# test_with_pytest.py
|
|
import pytest
|
|
from app.src.singleton import Singleton
|
|
|
|
class Test(metaclass=Singleton):
|
|
def __init__(self):
|
|
pass # is a dummy test class
|
|
|
|
def test_singleton_metaclass():
|
|
a = Test()
|
|
assert 1 == len(Singleton._instances)
|
|
b = Test()
|
|
assert 1 == len(Singleton._instances)
|
|
assert a is b
|
|
del a
|
|
assert 1 == len(Singleton._instances)
|
|
del b
|
|
assert 0 == len(Singleton._instances)
|