K
K
ksvdon2015-12-10 10:49:01
linux
ksvdon, 2015-12-10 10:49:01

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

8 answer(s)
3
3vi1_0n3, 2015-12-10
@3vi1_0n3

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.

D
Denis, 2015-12-17
@Norkotik

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

A
angru, 2015-12-10
@angru

can you python script from bash
ps ansible ?

P
Pavel Karateev, 2015-12-10
@Lancelote

I think paver is a good fit, it's simpler than ansible and more "thematic" for this case.

A
alexander sm1ly, 2015-12-17
@sm1ly

look towards salt stack saltstack.com

Y
Yuri Lobanov, 2014-04-05
@eprivalov

jsfiddle.net/R86VP/2

A
andreyqin, 2014-04-05
@andreyqin

jsfiddle.net/YEq75

L
lega, 2014-04-06
@lega

jsfiddle.net/lega911/cX9GR

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question