Permalink
Browse files

Refactoring for generate_big_project

  • Loading branch information...
1 parent db5d422 commit 2ff17f159bdc54fdfaa82988596cf4e38661b0b8 @mikahanninen mikahanninen committed Oct 9, 2012
Showing with 14 additions and 8 deletions.
  1. +5 −6 pavement.py
  2. +9 −2 rtest/large_scale_keyword_test.py
View
@@ -112,19 +112,18 @@ def generate_big_project(options):
_set_development_path()
sys.path.insert(0, '.')
from rtest.large_scale_keyword_test import main
- dir = options.dir
- _log("DIR: %s" % dir)
- shutil.rmtree(dir, ignore_errors=True)
- sys.path.append(dir)
+ _log("Test project is created into directory (option 'd'): %s" % options.dir)
+ shutil.rmtree(options.dir, ignore_errors=True)
+ sys.path.append(options.dir)
try:
- assert main(dir, testlibs_count=int(options.libs), keyword_count=int(options.keywords),
+ assert main(options.dir, testlibs_count=int(options.libs), keyword_count=int(options.keywords),
testsuite_count=int(options.suites), tests_in_suite=int(options.tests),
resource_count=int(options.resourcefiles), resources_in_file=int(options.resources))
finally:
#if len(args) >= 1 and ("del" in args):
# shutil.rmtree(dir, ignore_errors=True)
#else:
- _log("Not removing: " + dir)
+ _log("Not removing directory: " + options.dir)
@task
@@ -79,7 +79,6 @@ def __init__(self):
counter += 1
kw_name = verb + "_" + lib_main
db_cursor.execute("INSERT INTO keywords (name,source) VALUES ('%s','%s')" % (kw_name,lib_name))
- print "KW %s IN %s" % (kw_name, lib_name)
libfile.write(\
"""
def %s():
@@ -138,7 +137,6 @@ def _create_test_suite(path, filecount = 1, testcount = 20):
tc_withname = key
break
tc_name = "Test %s in %s #%d" % (random.choice(verbs), selected_library.split("CustomLib")[1], tc)
- print tc_name
available_keywords = db_cursor.execute("SELECT * FROM keywords WHERE source = '%s' ORDER BY RANDOM()"
% selected_library).fetchall()
kwlib = random.choice([selected_library, tc_withname, tc_withname + "xyz"])
@@ -190,6 +188,15 @@ def _create_test_project(path,testlibs_count=5,keyword_count=10,testsuite_count=
thetestdir = os.path.join(path, 'testdir')
shutil.copytree(os.path.join(ROOT, 'testdir'), thetestdir)
+ print """Generating test project with following settings
+ %d test libraries (option 'l')
+ %d keywords per test library (option 'k')
+ %d test suites (option 's')
+ %d tests per test suite (option 't')
+ %d resource files (option 'f')
+ %d resources per resource file (option 'r')""" % (testlibs_count, keyword_count, testsuite_count,
+ tests_in_suite, resource_count, resources_in_file)
+
_create_test_libraries(thetestdir, filecount=testlibs_count, keywords=keyword_count)
_create_test_resources(thetestdir + "/resources", filecount=resource_count,resource_count=resources_in_file)
_create_test_suite(thetestdir, filecount=testsuite_count, testcount=tests_in_suite)

0 comments on commit 2ff17f1

Please sign in to comment.