xref: /freebsd/tests/examples/test_ktest_example.py (revision 3e5d0784b9b5296bda801add034b057ad68237f7)
1*3e5d0784SAlexander V. Chernikovimport pytest
2*3e5d0784SAlexander V. Chernikov
3*3e5d0784SAlexander V. Chernikovfrom atf_python.ktest import BaseKernelTest
4*3e5d0784SAlexander V. Chernikov
5*3e5d0784SAlexander V. Chernikovfrom atf_python.sys.netlink.attrs import NlAttrStr
6*3e5d0784SAlexander V. Chernikovfrom atf_python.sys.netlink.attrs import NlAttrU32
7*3e5d0784SAlexander V. Chernikov
8*3e5d0784SAlexander V. Chernikov
9*3e5d0784SAlexander V. Chernikovclass TestExample(BaseKernelTest):
10*3e5d0784SAlexander V. Chernikov    KTEST_MODULE_NAME = "ktest_example"
11*3e5d0784SAlexander V. Chernikov
12*3e5d0784SAlexander V. Chernikov    @pytest.mark.parametrize(
13*3e5d0784SAlexander V. Chernikov        "numbers",
14*3e5d0784SAlexander V. Chernikov        [
15*3e5d0784SAlexander V. Chernikov            pytest.param([1, 2], id="1_2_Sum"),
16*3e5d0784SAlexander V. Chernikov            pytest.param([3, 4], id="3_4_Sum"),
17*3e5d0784SAlexander V. Chernikov        ],
18*3e5d0784SAlexander V. Chernikov    )
19*3e5d0784SAlexander V. Chernikov    def test_with_params(self, numbers):
20*3e5d0784SAlexander V. Chernikov        """override to parametrize"""
21*3e5d0784SAlexander V. Chernikov
22*3e5d0784SAlexander V. Chernikov        test_meta = [
23*3e5d0784SAlexander V. Chernikov            NlAttrU32(1, numbers[0]),
24*3e5d0784SAlexander V. Chernikov            NlAttrU32(2, numbers[1]),
25*3e5d0784SAlexander V. Chernikov            NlAttrStr(3, "test string"),
26*3e5d0784SAlexander V. Chernikov        ]
27*3e5d0784SAlexander V. Chernikov        self.runtest(test_meta)
28*3e5d0784SAlexander V. Chernikov
29*3e5d0784SAlexander V. Chernikov    @pytest.mark.skip(reason="comment me ( or delete the func) to run the test")
30*3e5d0784SAlexander V. Chernikov    def test_failed(self):
31*3e5d0784SAlexander V. Chernikov        pass
32*3e5d0784SAlexander V. Chernikov
33*3e5d0784SAlexander V. Chernikov    @pytest.mark.skip(reason="comment me ( or delete the func) to run the test")
34*3e5d0784SAlexander V. Chernikov    def test_failed2(self):
35*3e5d0784SAlexander V. Chernikov        pass
36