Answer the question
In order to leave comments, you need to log in
How to properly combine bash and python in autotests?
I am writing an autotest in which you need to do certain actions in bash (install the necessary packages, check for the presence of some files, etc., etc.). After that, I will need to perform actions in the browser (I will use the capabilities of Selenium + Python). I do not have a clear understanding of how to do it beautifully / correctly / (as is customary). I'm asking this question so I don't have to reinvent the wheel. I know that it is possible to execute bash commands from a python script, but still, how reasonable would it be (after all, this is not a single command, but in fact a small script is obtained)? Who faced? Perhaps it makes sense to make a separate bash script separately from python?
Answer the question
In order to leave comments, you need to log in
It is quite normal if the script is not very large.
I would make a call of commands from a python and did not produce entities. At the same time, you can do error handling in python in case it is impossible to install packages, for example.
Write a function, the argument for which will be the text of the bash command str. And execute bash commands in the body of the script
I think paver is a good fit, it's simpler than ansible and more "thematic" for this case.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question