I am using CentOs 6. I have got two scripts test1.py and test2.py in same directory.

I am running one test at a time as below from terminal:

py.test --html=report.html --self-contained-html test1.py

I want to create a shell script so that I can pass the script name (test1.py, test2.py) as parameter .


1 Answer 1


Create a script run_test.sh as follow:


# Take the first argument with $1
py.test --html=report.html --self-contained-html $1

To run this script execute

$ bash run_test.sh <name_of_python_file>

Or make it executable with

$ chmod +x run_test.sh 

and then you can launch it with

./run_test.sh <name_of_python_file>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .