Search code examples
pythonpycharmpytestpywinauto

How run pytest after pywinauto in script


I run my pywinauto test and I want the pytest to run after it. Now i run it with pycharm (Run->Edit configurations->Before launch:Activate tool window->Add run another configuration), but i want to run it with script. https://i.sstatic.net/bHBAC.png

In case1.py i tried:

subprocess.call(["python","tests\\test_xml_filename.py"])
os.system('C:\\Users\\user\\PycharmProjects\\pywinauto\\venv\\Scripts\\python C:\\Users\\user\\PycharmProjects\\pywinauto\\tests\\test_xml_filename.py')

but it still not work


Solution

  • It's not related to pywinauto. Just use subprocess.check_output(...).

    output = subprocess.check_output("<your command>")
    print(output)
    

    Real-time passing stdout from child to parent process is not easy implementable. Why not using import script as a module and call dedicated function? One process, one stdout - it's much easier to maintain.