Replicated kernel module unittest with pytest
This commit is contained in:
parent
3461272611
commit
900988e5ce
3 changed files with 20 additions and 0 deletions
0
pytests/modules/__init__.py
Normal file
0
pytests/modules/__init__.py
Normal file
0
pytests/modules/contrib/__init__.py
Normal file
0
pytests/modules/contrib/__init__.py
Normal file
20
pytests/modules/contrib/test_kernel.py
Normal file
20
pytests/modules/contrib/test_kernel.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
import pytest
|
||||
|
||||
import core.config
|
||||
import modules.contrib.kernel
|
||||
|
||||
@pytest.fixture
|
||||
def some_kernel():
|
||||
return "this-is-my-kernel"
|
||||
|
||||
@pytest.fixture
|
||||
def kernel_module():
|
||||
return modules.contrib.kernel.Module(config=core.config.Config([]), theme=None)
|
||||
|
||||
def test_full_text(mocker, kernel_module):
|
||||
platform = mocker.patch('modules.contrib.kernel.platform')
|
||||
platform.release.return_value = some_kernel
|
||||
assert len(kernel_module.widgets()) == 1
|
||||
assert some_kernel == kernel_module.widget().full_text()
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
Loading…
Reference in a new issue