意思就是我希望将 conftest.py 文件跟 test.py 文件还有其他依赖文件全部打包进去,然后将打包好的文件或文件夹(里面不能出现任何一个.py 脚本)放在其他机器上,依然可以顺利执行用例,但是目前的状况是:打包好之后,无法执行用例;
添加 conftest.py 和 test.py 文件,这个是可以运行起来的,现在就是不希望放 PY 文件跑
希望可以在无 Python 环境的机器上去执行用例
么有人,自己顶一哈!
@lang @oscarforever 大佬再请教你个问题,在打包成 exe 之后,单独通过 exe 执行(脱离.py 文件)时,发现测试脚本无法找到 fixture,希望大佬可以帮忙解答下,多谢啦!
已将 conftest.py 文件进行过打包
多谢大佬,成功解决了,非常感谢!
不过还是比较纳闷为啥没打包的话,就提示已注册了呢
还是不行哦,跟版本有没有关系呢,这是报错详情,方便的话加哈微信指导下,多谢啦,18602959120
Traceback (most recent call last):
File "D:/Workspace/WEB_Project/run.py", line 63, in
run()
File "D:/Workspace/WEB_Project/run.py", line 36, in run
pytest.main(args=args, plugins=[allure_plugin])
File "D:\Python\Python37\Lib\site-packages_pytest\config_init.py", line 58, in main
config = _prepareconfig(args, plugins)
File "D:\Python\Python37\Lib\site-packages_pytest\config__init.py", line 196, in _prepareconfig
pluginmanager=pluginmanager, args=args
File "D:\Python\Python37\Lib\site-packages\pluggy\hooks.py", line 289, in __call_
return self.hookexec(self, self.get_hookimpls(), kwargs)
File "D:\Python\Python37\Lib\site-packages\pluggy\manager.py", line 87, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "D:\Python\Python37\Lib\site-packages\pluggy\manager.py", line 81, in
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
File "D:\Python\Python37\Lib\site-packages\pluggy\callers.py", line 203, in _multicall
gen.send(outcome)
File "D:\Python\Python37\Lib\site-packages_pytest\helpconfig.py", line 93, in pytest_cmdline_parse
config = outcome.get_result()
File "D:\Python\Python37\Lib\site-packages\pluggy\callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "D:\Python\Python37\Lib\site-packages\pluggy\callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "D:\Python\Python37\Lib\site-packages_pytest\config__init.py", line 675, in pytest_cmdline_parse
self.parse(args)
File "D:\Python\Python37\Lib\site-packages_pytest\config__init.py", line 854, in parse
self._preparse(args, addopts=addopts)
File "D:\Python\Python37\Lib\site-packages_pytest\config__init.py", line 808, in _preparse
self.pluginmanager.load_setuptools_entrypoints("pytest11")
File "D:\Python\Python37\Lib\site-packages\pluggy\manager.py", line 293, in load_setuptools_entrypoints
self.register(plugin, name=ep.name)
File "D:\Python\Python37\Lib\site-packages_pytest\config__init.py", line 306, in register
ret = super(PytestPluginManager, self).register(plugin, name)
File "D:\Python\Python37\Lib\site-packages\pluggy\manager.py", line 100, in register
% (plugin_name, plugin, self._name2plugin)
ValueError: Plugin already registered: allure_pytest=
{'127516568': <_pytest.config.PytestPluginManager object at 0x000000000799BF98>, 'pytestconfig': <_pytest.config.Config object at 0x00000000079BEA20>, 'mark': <module '_pytest.mark' from 'D:\Python\Python37\Lib\site-packages\_pytest\mark\__init.py'>, 'main': , 'terminal': , 'runner': , 'python': , 'fixtures': , 'debugging': , 'unittest': , 'capture': , 'skipping': , 'tmpdir': , 'monkeypatch': , 'recwarn': , 'pastebin': , 'helpconfig': , 'nose': , 'assertion': <module '_pytest.assertion' from 'D:\Python\Python37\Lib\site-packages\_pytest\assertion\__init_.py'>, 'junitxml': , 'resultlog': , 'doctest': , 'cacheprovider': , 'freeze_support': , 'setuponly': , 'setupplan': , 'stepwise': , 'warnings': , 'logging': , 'allure_pytest.plugin': }
Process finished with exit code 1
可否具体呀,大佬
'--alluredir=./report/xml'参数去掉吗,还是怎么弄呢
我也遇到同样的问题了,貌似打包时未将 pytets、allure 打包进去,查询之后将 pytest、allure 强制添加打包进去,也不行,希望有知道的帮忙指点一下,多谢啦!