51Testing软件测试论坛

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

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 1748|回复: 5
打印 上一主题 下一主题

求教:pytest 安装后,查看 pytest --version 报错

[复制链接]
  • TA的每日心情
    无聊
    昨天 09:47
  • 签到天数: 528 天

    连续签到: 1 天

    [LV.9]测试副司令

    跳转到指定楼层
    1#
    发表于 2021-7-13 13:44:25 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    1测试积点
    我使用以下命令 pip install -U pytest,安装了 pytest,显示是正常安装了,但是 pytest --version 查看版本后,出现了报错,我的 Python 是 3.7.0 版本的,最新 pytest 是 6.2.4 版本,怀疑是版本兼容问题,又使用了 5.3.0 和 4 的版本,依然没有解决,求教下大家,有没有什么解决方法
    1. C:\Users\chenlibao>pip install -U pytest
    2. Requirement already up-to-date: pytest in c:\python37\lib\site-packages (6.2.4)
    3. Requirement already satisfied, skipping upgrade: atomicwrites>=1.0; sys_platform == "win32" in c:\python37\lib\site-packages (from pytest) (1.4.0)
    4. Requirement already satisfied, skipping upgrade: iniconfig in c:\python37\lib\site-packages (from pytest) (1.1.1)
    5. Requirement already satisfied, skipping upgrade: packaging in c:\python37\lib\site-packages (from pytest) (20.9)
    6. Requirement already satisfied, skipping upgrade: py>=1.8.2 in c:\python37\lib\site-packages (from pytest) (1.10.0)
    7. Requirement already satisfied, skipping upgrade: toml in c:\python37\lib\site-packages (from pytest) (0.10.2)
    8. Requirement already satisfied, skipping upgrade: attrs>=19.2.0 in c:\python37\lib\site-packages (from pytest) (19.2.0)
    9. Requirement already satisfied, skipping upgrade: importlib-metadata>=0.12; python_version < "3.8" in c:\python37\lib\site-packages (from pytest) (1.3.0)
    10. Requirement already satisfied, skipping upgrade: colorama; sys_platform == "win32" in c:\python37\lib\site-packages (from pytest) (0.4.1)
    11. Requirement already satisfied, skipping upgrade: pluggy<1.0.0a1,>=0.12 in c:\python37\lib\site-packages (from pytest) (0.13.1)
    12. Requirement already satisfied, skipping upgrade: pyparsing>=2.0.2 in c:\python37\lib\site-packages (from packaging->pytest) (2.4.2)
    13. Requirement already satisfied, skipping upgrade: zipp>=0.5 in c:\python37\lib\site-packages (from importlib-metadata>=0.12; python_version < "3.8"->pytest) (0.6.0)
    14. Requirement already satisfied, skipping upgrade: more-itertools in c:\python37\lib\site-packages (from zipp>=0.5->importlib-metadata>=0.12; python_version < "3.8"->pytest) (8.0.2)
    15. You are using pip version 19.0.3, however version 21.1.3 is available.
    16. You should consider upgrading via the 'python -m pip install --upgrade pip' command.
    复制代码
    查看版本,出现报错
    1. C:\Users\chenlibao>pytest --version
    2. Traceback (most recent call last):
    3.   File "c:\python37\lib\runpy.py", line 193, in _run_module_as_main
    4.     "__main__", mod_spec)
    5.   File "c:\python37\lib\runpy.py", line 85, in _run_code
    6.     exec(code, run_globals)
    7.   File "C:\Python37\Scripts\pytest.exe\__main__.py", line 9, in <module>
    8.   File "c:\python37\lib\site-packages\_pytest\config\__init__.py", line 185, in console_main
    9.     code = main()
    10.   File "c:\python37\lib\site-packages\_pytest\config\__init__.py", line 143, in main
    11.     config = _prepareconfig(args, plugins)
    12.   File "c:\python37\lib\site-packages\_pytest\config\__init__.py", line 319, in _prepareconfig
    13.     pluginmanager=pluginmanager, args=args
    14.   File "c:\python37\lib\site-packages\pluggy\hooks.py", line 286, in __call__
    15.     return self._hookexec(self, self.get_hookimpls(), kwargs)
    16.   File "c:\python37\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
    17.     return self._inner_hookexec(hook, methods, kwargs)
    18.   File "c:\python37\lib\site-packages\pluggy\manager.py", line 87, in <lambda>
    19.     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
    20.   File "c:\python37\lib\site-packages\pluggy\callers.py", line 203, in _multicall
    21.     gen.send(outcome)
    22.   File "c:\python37\lib\site-packages\_pytest\helpconfig.py", line 100, in pytest_cmdline_parse
    23.     config: Config = outcome.get_result()
    24.   File "c:\python37\lib\site-packages\pluggy\callers.py", line 80, in get_result
    25.     raise ex[1].with_traceback(ex[2])
    26.   File "c:\python37\lib\site-packages\pluggy\callers.py", line 187, in _multicall
    27.     res = hook_impl.function(*args)
    28.   File "c:\python37\lib\site-packages\_pytest\config\__init__.py", line 1003, in pytest_cmdline_parse
    29.     self.parse(args)
    30.   File "c:\python37\lib\site-packages\_pytest\config\__init__.py", line 1283, in parse
    31.     self._preparse(args, addopts=addopts)
    32.   File "c:\python37\lib\site-packages\_pytest\config\__init__.py", line 1172, in _preparse
    33.     self.pluginmanager.load_setuptools_entrypoints("pytest11")
    34.   File "c:\python37\lib\site-packages\pluggy\manager.py", line 299, in load_setuptools_entrypoints
    35.     plugin = ep.load()
    36.   File "c:\python37\lib\site-packages\importlib_metadata\__init__.py", line 94, in load
    37.     module = import_module(match.group('module'))
    38.   File "c:\python37\lib\importlib\__init__.py", line 127, in import_module
    39.     return _bootstrap._gcd_import(name[level:], package, level)
    40.   File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
    41.   File "<frozen importlib._bootstrap>", line 983, in _find_and_load
    42.   File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
    43.   File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
    44.   File "c:\python37\lib\site-packages\_pytest\assertion\rewrite.py", line 170, in exec_module
    45.     exec(co, module.__dict__)
    46.   File "c:\python37\lib\site-packages\celery\contrib\pytest.py", line 6, in <module>
    47.     from .testing import worker
    48.   File "<frozen importlib._bootstrap>", line 983, in _find_and_load
    49.   File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
    50.   File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
    51.   File "c:\python37\lib\site-packages\_pytest\assertion\rewrite.py", line 170, in exec_module
    52.     exec(co, module.__dict__)
    53.   File "c:\python37\lib\site-packages\celery\contrib\testing\worker.py", line 6, in <module>
    54.     from celery import worker
    55.   File "<frozen importlib._bootstrap>", line 983, in _find_and_load
    56.   File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
    57.   File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
    58.   File "c:\python37\lib\site-packages\_pytest\assertion\rewrite.py", line 170, in exec_module
    59.     exec(co, module.__dict__)
    60.   File "c:\python37\lib\site-packages\celery\worker\__init__.py", line 3, in <module>
    61.     from .worker import WorkController
    62.   File "<frozen importlib._bootstrap>", line 983, in _find_and_load
    63.   File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
    64.   File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
    65.   File "c:\python37\lib\site-packages\_pytest\assertion\rewrite.py", line 161, in exec_module
    66.     source_stat, co = _rewrite_test(fn, self.config)
    67.   File "c:\python37\lib\site-packages\_pytest\assertion\rewrite.py", line 354, in _rewrite_test
    68.     tree = ast.parse(source, filename=fn_)
    69.   File "c:\python37\lib\ast.py", line 35, in parse
    70.     return compile(source, filename, mode, PyCF_ONLY_AST)
    71.   File "c:\python37\lib\site-packages\celery\worker\worker.py", line 241
    72.     self._conninfo.transport.implements.async and
    73.                                             ^
    74. SyntaxError: invalid syntax
    复制代码




    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏
    回复

    使用道具 举报

  • TA的每日心情
    慵懒
    8 小时前
  • 签到天数: 1518 天

    连续签到: 2 天

    [LV.Master]测试大本营

    2#
    发表于 2021-7-14 10:29:48 | 只看该作者
    环境变量检查下
    回复

    使用道具 举报

  • TA的每日心情
    奋斗
    3 小时前
  • 签到天数: 753 天

    连续签到: 2 天

    [LV.10]测试总司令

    3#
    发表于 2021-7-14 10:48:22 | 只看该作者
    回复

    使用道具 举报

  • TA的每日心情
    奋斗
    9 小时前
  • 签到天数: 1803 天

    连续签到: 2 天

    [LV.Master]测试大本营

    4#
    发表于 2021-7-14 13:35:34 | 只看该作者
    环境变量配的不对
    回复

    使用道具 举报

  • TA的每日心情
    奋斗
    2024-10-22 14:23
  • 签到天数: 1007 天

    连续签到: 1 天

    [LV.10]测试总司令

    5#
    发表于 2021-7-14 14:14:28 | 只看该作者
    看着像是 celery 与 python 的版本冲突, 你把 celery 升下级试试。
    回复

    使用道具 举报

  • TA的每日心情
    奋斗
    8 小时前
  • 签到天数: 993 天

    连续签到: 2 天

    [LV.10]测试总司令

    6#
    发表于 2021-7-14 16:45:12 | 只看该作者
    重新配置下环境变量吧
    回复

    使用道具 举报

    本版积分规则

    关闭

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

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

    GMT+8, 2024-11-19 18:26 , Processed in 0.061570 second(s), 22 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

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