3

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 ?

4
  • What does --with-shell do? I don't know if it's a stock option. If it's something that you're adding, what do you expect it to do? Commented Apr 17, 2011 at 18:10
  • i expect it to run arbitrary shell commands, e.g. "ls -l" , or myPython.py whoch takes arguments itself Commented Apr 17, 2011 at 18:29
  • And what's the purpose of this? What's the difference between using nose to run these scripts and directly calling them using myTest.py test? Commented Apr 17, 2011 at 18:30
  • @Noufal because i want to use one tool (one command line) as a one button test start , and also while staying in nose be able to run external commands. I could do it all in a shell script, but then, my goal is to use nose as a Test Automation framework. Makes sense ? this way, i am using nose's ability to find tests and render results and run unit tests, which are already integrated with Jenkins Commented Apr 17, 2011 at 19:14

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.