File: test_testkit.py

package info (click to toggle)
python-pbcommand 2.1.1%2Bgit20231020.28d1635-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,016 kB
  • sloc: python: 7,676; makefile: 220; sh: 73
file content (25 lines) | stat: -rw-r--r-- 682 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from pbcommand.testkit.base_utils import pb_requirements


class TestBaseUtils:

    def test_pb_requirements_decorator(self):
        """
        Test that the pb_requirements decorator monkey-patches test methods
        correctly.
        """
        class MyTestClass:
            @pb_requirements("SL-1")
            def test_1(self):
                assert True

            @pb_requirements("SL-2")
            def test_2(self):
                self.fail("Fail!")

        methods = [
            MyTestClass.test_1,
            MyTestClass.test_2,
        ]
        requirements = [m.__pb_requirements__ for m in methods]
        assert requirements == [['SL-1'], ['SL-2']]