top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

Run all test in a directory using Python Script?

+5 votes

I am building my script. I want to run all the test scripts.

Currently I am running the code "python test", it is running only the some tests in my directory. I want to run all the tests in my directory.

posted Oct 30, 2013 by Dewang Chaudhary

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

0 votes

I am building my script. I want to run all the test scripts.

What version of Python are you using? Test discovery is now a part of the standard library unittest module. If you are using Python earlier than version 2.7, you can use a third-party module for adding test discovery to the standard test runner .

Currently I am running the code "python test"

That invokes whatever the defines as the test suite and runner. You'll need to change that in order to get it to run the tests differently.

answer Oct 30, 2013 by Jai Prakash
Similar Questions
0 votes

How to run a python script twice randomly in a day? Actually I want to run my script randomly in a day and twice only. Please help me.. how is it possible.

+2 votes

I want to take the file, "desktop/test.txt" and write it to "desktop/newfolder/test.txt". I tried the below script, and it gave me: "IOError: [Errno 2] No such file or directory: 'desktop/%s.txt'". Any suggestions would be great.

def firstdev(file):
 in_file = open("desktop/%s.txt") % file
 indata =
 out_file = open("desktop/newfolder/%s.txt", 'w') % file

+1 vote

I am Automating some repetitive works through Sikuli and Python scripting languages. I have multiple workflows. I need to schedule this script for every two hours. Can anyone guide me how to schedule the scripts for every two hours.

Is there any way to schedule the python programming through Task scheduler in windows platform.

My environment
Programming languages: Sikuli,Python

0 votes

I'm trying to write a python script that writes some content to a file root through sudo, but it's not working at all. I am using:

 channel = 'stable'
 config_file = '/opt/ldg/etc/channel.conf'
 command = ['echo', '-n', channel, '|', 'sudo', 'tee', config_file]
 p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 out, _ = p.communicate()

But it seems as if this isn't doing anything.

I just want to write the contents of the variable channel to the file /opt/ldg/etc/channel.conf. But whatever I try just doesn't work. Can anyone offer any pointers?

Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.