51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

查看: 2110|回复: 1
打印 上一主题 下一主题

pytest运行报错AttributeError: 'Function' object has no attribute 'get_marker'

[复制链接]
  • TA的每日心情
    奋斗
    2020-12-31 15:38
  • 签到天数: 196 天

    连续签到: 1 天

    [LV.7]测试师长

    跳转到指定楼层
    1#
    发表于 2019-8-22 11:22:48 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    代码如下
    1. from selenium import webdriver
    2. import random
    3. import pytest

    4. class Test_restart(object):

    5.     @pytest.fixture(scope="function", autouse=True)
    6.     def setUp(self):
    7.         global dr
    8.         dr = webdriver.Chrome('D:\\chromedriver456.exe')
    9.         yield
    10.         dr.quit()

    11.     def test_one(self):

    12.         assert random.randint(1, 3) == 3

    13.         dr.maximize_window()

    14.         dr.get('https://www.baidu.com/')

    15.         dr.implicitly_wait(3)
    复制代码

    运行就会报错,日志如下
    1. Test_restart.py E                                                        [100%]

    2. =================================== ERRORS ====================================
    3. ___________________ ERROR at setup of Test_restart.test_one ___________________

    4. item = <Function test_one>

    5.     def pytest_runtest_setup(item):
    6.    
    7. >       remote_data = item.get_marker('remote_data')
    8. E       AttributeError: 'Function' object has no attribute 'get_marker'

    9. d:\python3\lib\site-packages\pytest_remotedata\plugin.py:59: AttributeError
    10. ============================== 1 error in 0.35s ===============================
    复制代码

    pytest 5.1.1 ,用3.10.1就没事 求助大佬
    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏
    回复

    使用道具 举报

  • TA的每日心情
    奋斗
    2020-12-31 15:38
  • 签到天数: 196 天

    连续签到: 1 天

    [LV.7]测试师长

    2#
     楼主| 发表于 2019-8-23 09:31:56 | 只看该作者
    解决的了 pytest_remotedata版本 相对 pytest版本过低导致的
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-4-24 05:08 , Processed in 0.061262 second(s), 22 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表