Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytest-xdist多进程自动化中如何将日志打印到终端上 #75

Open
li7pd opened this issue Jul 12, 2024 · 4 comments
Open

pytest-xdist多进程自动化中如何将日志打印到终端上 #75

li7pd opened this issue Jul 12, 2024 · 4 comments

Comments

@li7pd
Copy link

li7pd commented Jul 12, 2024

在使用pytest-xdist进行分布式自动化测试时,无法将log输出到终端,但是可以正常写入到log文件中,后续是否有对此的插件的支持和优化
image

@ydf0509
Copy link
Owner

ydf0509 commented Jul 12, 2024

nb_log的logger对象原生logging.Logger类型,所以这种通用问题是pytest对日志的策略,并不是nb_log要做什么变化,因为nb_log就是logging.Logger对象。

这样问文心一言

image

@ydf0509
Copy link
Owner

ydf0509 commented Jul 12, 2024

pytest默认是为了避免低日志级别打扰用户,所以屏蔽你日志啊,这种问题是pytest对日志的策略,有参数可以控制的

@li7pd
Copy link
Author

li7pd commented Jul 12, 2024

pytest默认是为了避免低日志级别打扰用户,所以屏蔽你日志啊,这种问题是pytest对日志的策略,有参数可以控制的

我排查过,并不是pytest的配置的问题,因为我不使用pytest-xdist这个并发插件,log日志是可以正常打印出来的,只有使用pytest-xdist这个插件,并且设置了并发量,才会导致无法输出到屏幕
pytest-xdist没有设置并发量(相当于没有启用插件)
image

pytest-xdist设置并发量
image

@ydf0509
Copy link
Owner

ydf0509 commented Jul 13, 2024

这种问题应该搜索pytestxdist啊,可能你没掌握有什么传参呗。问 文心一言就可以了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants