utx icon indicating copy to clipboard operation
utx copied to clipboard

AttributeError: 'NoneType' object has no attribute '__case_tag__'

Open ssfanli opened this issue 4 years ago • 0 comments

现象

  1. 重写unittest的__init__、setUpClass 和 tearDownClass到BaseUnittest
  2. 在HomePageTest 中继承
  3. 用tag标签

运行报错如下

File "/Users/ssfanli/Myfolder/pyproj/work/YSPCheckListAndroid/case/test_1_home_page.py", line 17, in <module>
    class HomePageTest(BaseUnittest):
  File "/Users/ssfanli/Myfolder/pyproj/work/YSPCheckListAndroid/utx/core.py", line 220, in __new__
    setattr(test_case, CASE_TAG_FLAG, {Tag.ALL})  # 没有指定tag的用例,默认带有tag:ALL
AttributeError: 'NoneType' object has no attribute '__case_tag__'

case片段

class HomePageTest(BaseUnittest):

    def setUp(self) -> None:
        self.hp = HomePage(self.d)

    def tearDown(self) -> None:
        self.hp.auto_back()

    @tag(Tag.SMOKE)
    def test_recommend(self):
        ......

ssfanli avatar Aug 20 '20 01:08 ssfanli