V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
Ctry
V2EX  ›  Python

pyinstaller 打包 pytest+allure 自动化测试框架后运行报错,请大牛指教

  •  
  •   Ctry · 2020-04-22 12:16:46 +08:00 · 1986 次点击
    这是一个创建于 1437 天前的主题,其中的信息可能已经有所发展或是发生改变。

    如图,使用 pyinstaller 打包测试后,在调用 pytest.main()时,运行后提示如下:

    ERROR: usage: run_main.exe [options] [file_or_dir] [file_or_dir] [...]

    run_main.exe: error: unrecognized arguments: --alluredir=W:\StudyLibrary\csc-rms-apitest\dist\run_main\reports\result\2020-04-22 inifile: None rootdir: W:\StudyLibrary\csc-rms-apitest\dist\run_main

    pytest 调用如下:

    def m_run(case_path, allure_path, test_count, allure_report_path):
        pytest.main(['-v',
                     '-s',
                     case_path,
                     '--alluredir',allure_path,
                     '--count', str(test_count),
                     '--repeat-scope=function',
                     '--disable-warnings',
                     '--capture=no',
                     ])
    

    pyinstaller 的 spec 文件如下:

    block_cipher = None
    
    
    a = Analysis(['D:\\mytools\\SmokingTestCase_for_exe\\run_ui.py'],
                 pathex=['C:\\Users\\Dell','D:\\mytools\\SmokingTestCase_for_exe',
                'D:\\mytools\\python\\python3_7\Lib\\site-packages'],
                 binaries=[],
                 datas=[('D:\\mytools\\SmokingTestCase_for_exe\\testcase\\*.py',
                            'testcase'),
                        ('D:\\mytools\\SmokingTestCase_for_exe\\testdata\\*.yaml',
                            'testdata'),
                            ('D:\\mytools\\SmokingTestCase_for_exe\\page\\*.py',
                            'page'),
                            ('D:\\mytools\\SmokingTestCase_for_exe\\*.py',
                            '.'),
                ],   
                 hiddenimports=['page','myemail','mylog'],
                 hookspath=[],
                 runtime_hooks=[],
                 excludes=[],
                 win_no_prefer_redirects=False,
                 win_private_assemblies=False,
                 cipher=block_cipher,
                 noarchive=False)
    pyz = PYZ(a.pure, a.zipped_data,
                 cipher=block_cipher)
    exe = EXE(pyz,
              a.scripts,
              a.binaries,
              a.zipfiles,
              a.datas,
              [],
              name='run_ui',
              debug=True,
              bootloader_ignore_signals=False,
              strip=False,
              upx=True,
              upx_exclude=[],
              runtime_tmpdir=None,
              console=True )
    

    完全没头绪为什么会出现这种情况,去除 -allure 和--count 两个参数就能正常运行,求大佬帮助

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2736 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 12:42 · PVG 20:42 · LAX 05:42 · JFK 08:42
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.