Relative Content

Tag Archive for pythonpytest

Really call `os.system` from pytest

Apparently, pytest restricts you from calling os.system. I develop streamcapture, and the crucial feature is that it captures the stdout of processes spawned by os.system, across MacOS, Linux and Windows, so I really need to unit test this capability.

Need help/understanding test functions with pytest

I need help creating test function that can be executed by pytest. I have created one and it passed but I need to test for each function I created and don’t know how to do that. I have tried using assert but all my test fail. I have watch videos on understanding test but I cant seem to grasp on how to use it. I could use your help. Here’s what i have so far…

pytest failing to generate xml correctly

Unable to generate junit xml file correctly, after a failure generation of the file stops and no further tests are executed. The command works without the junit argument. I have also tried adding ‘-o junit_family=xunit1’ but this did not resolve the issue. We are using Python 3.10.6, pytest-8.2.2, but this failed also on pytest 6.2.5.