Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i use nosetest to run an shell script or another python script

Tags:

python

nose

nose

is a test runner which extends PyUnit. Is it possible to write e.g

$ nosetests --with-shell myTest.py -myargs test

If not, then is there a plugin, or do i need to develop it myself. Any suggestions ?

like image 569
kamal Avatar asked Sep 09 '26 23:09

kamal


1 Answers

Nose is not a general test harness. It's specifically a Python harness which runs Python unit tests.

So, while you can write extensions for it to execute scripts and mark them as successes or failures based on the exit status or an output string, I think it's an attempt to shoehorn the harness into doing something it's not really meant to do.

You should package your tests as Python functions or classes and then have them use a library to run external scripts the output or behaviour of which is translated into something that nose can interpret rather than extend nose to directly run scripts.

Also, I've experimented with nose a bit and found it's extension mechanism quite clumsy compared to py.test. You might want to give that a shot.

like image 117
Noufal Ibrahim Avatar answered Sep 12 '26 11:09

Noufal Ibrahim