运行测试用例

import pytest
from WXP2P_2.test_data2.login_case import logindata_error1,logindata_error2,logindata_right
class TestLogin:
    """测试登录"""

    @pytest.mark.parametrize("data",logindata_error1)#装饰测试用例。
    @pytest.mark.wrong
    def test_error1(self,data,int_start):
        """错误信息"""
        int_start[0].login(data["use"],data["password"])
        try:
            assert (int_start[0].error_value()==data["expected"])
            print("测试用例通过,预期结果{}与实际结果{}一致".format(data["expected"],int_start[0].error_value()))
        except AssertionError as e:
            print("用例失败")
            raise e
        finally:
           int_start[0].clear()#清空输入框
        # Login().login(data["use"], data["password"])#错误示范,这种调用方法,会多次打开浏览器
        # Login().clear()#错误示范,这种调用方法,会多次打开网页
#     @pytest.mark.parametrize("data",logindata_error2)
#     def test_error2(self, data):
#         """错误信息"""
#         self.login.login(data["use"], data["password"])
#         try:
#             assert (self.login.error_value1() == data["expected"])
#             print("测试用例通过,预期结果{}与实际结果{}一致".format(data["expected"], self.login.error_value1()))
#         except AssertionError as e:
#             print("用例失败")
#             raise e
#         finally:
#             self.login.clear()  # 清空输入框
#     @pytest.mark.ok
#     @pytest.mark.parametrize("data",logindata_right)#装饰测试用例
#     def test_right(self,data):
#         """正确的信息登录"""
#         self.login.login(data["use"], data["password"])
#         try:
#             assert (data["expected"] in self.login.right_value())
#             print("测试用例通过,预期结果{}与实际结果{}一致".format(data["expected"], self.login.right_value()))
#         except AssertionError as e:
#             print("用例失败")
#             raise e
#         # Login().login(data["use"], data["password"])#错误示范,这种调用方法,会多次打开网页
if __name__ == '__main__':
    pytest.main(["-m wrong","-s"])

执行结果

Traceback (most recent call last):
  File "D:/WX_P2P_ITEM/WXP2P_2/test_login.py", line 46, in <module>
    pytest.main(["-m wrong","-s"])
  File "D:\Python\lib\site-packages\_pytest\config\__init__.py", line 60, in main
    config = _prepareconfig(args, plugins)
  File "D:\Python\lib\site-packages\_pytest\config\__init__.py", line 204, in _prepareconfig
    pluginmanager=pluginmanager, args=args
  File "D:\Python\lib\site-packages\pluggy\hooks.py", line 289, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "D:\Python\lib\site-packages\pluggy\manager.py", line 68, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "D:\Python\lib\site-packages\pluggy\manager.py", line 62, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "D:\Python\lib\site-packages\pluggy\callers.py", line 203, in _multicall
    gen.send(outcome)
  File "D:\Python\lib\site-packages\_pytest\helpconfig.py", line 93, in pytest_cmdline_parse
    config = outcome.get_result()
  File "D:\Python\lib\site-packages\pluggy\callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "D:\Python\lib\site-packages\pluggy\callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "D:\Python\lib\site-packages\_pytest\config\__init__.py", line 684, in pytest_cmdline_parse
    self.parse(args)
  File "D:\Python\lib\site-packages\_pytest\config\__init__.py", line 901, in parse
    self._preparse(args, addopts=addopts)
  File "D:\Python\lib\site-packages\_pytest\config\__init__.py", line 846, in _preparse
    self.pluginmanager.load_setuptools_entrypoints("pytest11")
  File "D:\Python\lib\site-packages\pluggy\manager.py", line 282, in load_setuptools_entrypoints
    self.register(plugin, name=ep.name)
  File "D:\Python\lib\site-packages\_pytest\config\__init__.py", line 318, in register
    ret = super(PytestPluginManager, self).register(plugin, name)
  File "D:\Python\lib\site-packages\pluggy\manager.py", line 102, in register
    hook._maybe_apply_history(hookimpl)
  File "D:\Python\lib\site-packages\pluggy\hooks.py", line 336, in _maybe_apply_history
    res = self._hookexec(self, [method], kwargs)
  File "D:\Python\lib\site-packages\pluggy\manager.py", line 68, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "D:\Python\lib\site-packages\pluggy\manager.py", line 62, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "D:\Python\lib\site-packages\pluggy\callers.py", line 208, in _multicall
    return outcome.get_result()
  File "D:\Python\lib\site-packages\pluggy\callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "D:\Python\lib\site-packages\pluggy\callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "D:\Python\lib\site-packages\allure_pytest\plugin.py", line 21, in pytest_addoption
    help="Generate Allure report in the specified directory (may not exist)")
  File "D:\Python\lib\site-packages\_pytest\config\argparsing.py", line 303, in addoption
    raise ValueError("option names %s already added" % conflict)
ValueError: option names {'--alluredir'} already added

这是因为pytest-allure-adaptor与allure-pytest的alluredir都被引用造成冲突

需要卸载pytest-allure-adaptor


卸载完成后,再执行测试模块

============================= test session starts =============================
platform win32 -- Python 3.6.3, pytest-4.5.0, py-1.8.0, pluggy-0.11.0
rootdir: D:\WX_P2P_ITEM\WXP2P_2
plugins: allure-pytest-2.6.5
collected 5 items / 3 deselected / 2 selected

test_login.py 测试用例通过,预期结果请输入正确的手机号与实际结果请输入正确的手机号一致
.测试用例通过,预期结果请输入手机号与实际结果请输入手机号一致
.

ValueError: option names {'--alluredir'} already added 报错的更多相关文章

  1. moviepy音视频剪辑:使用fl_time进行时间特效处理报错ValueError: Attribute duration not set

    专栏:Python基础教程目录 专栏:使用PyQt开发图形界面Python应用 专栏:PyQt+moviepy音视频剪辑实战 专栏:PyQt入门学习 老猿Python博文目录 老猿学5G博文目录 在使 ...

  2. Unity在OpenGL模式下Shader编译报错

    报错信息 GLSL compilation failed: 0(21) : error C7528: OpenGL reserves names containing '__' 双击报错VS自动打开V ...

  3. Oracle Online Patching报错"This is not a RAC setup. OPatch cannot determine the local node name"

    Oracle Online Patching报错"This is not a RAC setup. OPatch cannot determine the local node name&q ...

  4. 报错问题: AtrributeError:module ‘allure’ has no attribute ‘’severity_level’

    问题:执行命令报错:pytest -s -q --alluredir report 报错问题: AtrributeError:module 'allure' has no attribute ''se ...

  5. weblogic启动报错之Unrecognized option: -jrockit

    报错如下: $ ./startWebLogic.sh . . JAVA Memory arguments: -Xms512m -Xmx512m . WLS Start Mode=Production ...

  6. windows 8 安装 oracle 11g 报错:command line option syntax error,type command/? for help

    windows 8 安装 oracle 11g 报错:command line option syntax error,type command/? for help 在windows8操作系统上安装 ...

  7. Android报错:WindowManager$BadTokenException: Unable to add window -- window has already been added

    很久之前测试通过的代码,现在手机升级了Android7.0后一运行就崩溃,报出这样的错误,具体错误如下: Process: com.example.sho.android_anti_theft, PI ...

  8. tensorflow-TFRecord报错ValueError: Protocol message Feature has no "feature" field.

    编写代码用TFRecord数据结构存储数据集信息是报错:ValueError: Protocol message Feature has no "feature" field.或和 ...

  9. 关于SVN报错 svn: E170013 E125006: contains invalid filesystem format option 'addressing logical'

    在使用svn的时候,遇到了这样的一个问题 首先我使用TortoiseSVN 右键创建的repository. 之后用IDEA,配置了1.9.4版本的SVN,去commit访问这个仓库 结果出现了以下的 ...

随机推荐

  1. mysql使用小结

    一.修改 mysql 的 root 密码 mysql> use mysql;  mysql> update user set password=password('123456') whe ...

  2. 201621123016 《Java程序设计》第八周学习总结

    1. 本周学习总结 2. 书面作业 1. ArrayList代码分析 1.1 解释ArrayList的contains源代码 ArrayList在调用contains方法时会调用indexOf方法得到 ...

  3. DirectX实现球面纹理映射

    http://www.cnblogs.com/graphics/archive/2011/09/13/2174022.html DirectX实现球面纹理映射 介绍 球面纹理映射就是将一个平面纹理映射 ...

  4. profiler Reserved Total

    Used Total和Reserved 均是物理内存,其中Reserved是unity向系统申请的总内存,Unity底层为了不经常向系统申请开辟内存,开启了较大一块内存作为缓存,即所谓的Reserve ...

  5. [Xcode 实际操作]九、实用进阶-(7)使用Xcode的版本管理功能(SCM)

    目录:[Swift]Xcode实际操作 本文将演示系统的版本控制功能. 软件配置管理(SCM):Software configuration management 是指通过执行版本控制.变更控制的规程 ...

  6. ES6高级使用技巧(reduce,filter篇)

    本周总结 这几天在写Echarts自定义需求的时候发现了,图形化算法和函数式编程的应用场景,很多时候我们现在学的东西并一定在当前的这种状态有用,但是兴趣吧,喜欢就去学呗,没准在日后的工作日常中用到了 ...

  7. 你了解SVN, CVS等版本控制器吗?

    版本控制器SVN, CVS是两种版本控制器, 需要配套相关的SVN, CVS服务器, SCM是xcode里面配置版本控制的地方, 版本控制的原理就是A和B同时开发一个项目, A写完当天的代码之后把代码 ...

  8. Elasticsearch学习记录(分布式的特性)

    Elasticsearch学习记录(分布式的特性) 分布式的特性 我们提到Elasticsearch可以扩展到上百(甚至上千)的服务器来处理PB级的数据.然而我们的例子只给出了一些使用Elastics ...

  9. MySQL--表操作1

    这是对自己学习燕十八老师mysql教程的总结,非常感谢燕十八老师. 依赖软件:mysql 系统环境:win 注:本次所有命令都是在命令行上执行 数据库的四大天王操作:增删改查 增删改查都是在对表进行操 ...

  10. 「干货」常用的10个网络DOS命令,菜鸟学了变高手

    1 ping命令 1命令格式 ping 主机名 ping 域名 ping IP地址 如图所示,使用ping命令检查到IP地址210.43.16.17的计算机的连通性,该例为连接正常.共发送了四个测试数 ...