Skip to content
Snippets Groups Projects
Commit c6e3d811 authored by Ravi Tripathi's avatar Ravi Tripathi
Browse files

Giving choices in prep_env

parent e258ae21
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/python
import os
import argparse
import random, string
def create_testdir():
current_directory = os.getcwd()
......@@ -9,13 +11,32 @@ def create_testdir():
os.makedirs(final_directory)
return final_directory
def create_testfiles(dir):
def create_testfiles_seq(dir):
for x in range(1, 6):
filename = 'test' + str(x) + '.txt'
filename = 'test' + str(x)
with open(os.path.join(dir, filename), 'w'):
pass
def create_testfiles_rand(dir):
for x in range(1, 6):
filename = ''.join(random.sample((string.ascii_uppercase+string.digits),6))
with open(os.path.join(dir, filename), 'w'):
pass
def create_testfiles_diff(dir):
for x in range(1, 6):
filename = 'test' + str(x) + '.txt'
with open(os.path.join(dir, filename), 'w'):
pass
if __name__=="__main__":
#global final_directory
parser = argparse.ArgumentParser(description='Create a test environment to run parallelism.')
parser.add_argument('type', choices=['seq', 'rand', 'diff'], help='Type of test directory to create')
args = parser.parse_args()
testdir = create_testdir()
create_testfiles(testdir)
if args.type == 'seq':
create_testfiles_seq(testdir)
if args.type == 'rand':
create_testfiles_rand(testdir)
if args.type == 'seq':
create_testfiles_diff(testdir)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment