Skip to content

Commit

Permalink
rename unittests ending in _test.py
Browse files Browse the repository at this point in the history
Let's standardize that unittests do end in _unittest.py,
to avoid mistakes with test case files. In this process,
cleaned up the code of utils/unittest_suite, so we
don't have to resort to SKIP hacks and similar stuff.

Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
  • Loading branch information
lmr committed Apr 20, 2012
1 parent 7fa2ec1 commit 6e4d808
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 19 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion utils/coverage_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def is_valid_directory(dirpath):


def is_test_filename(filename):
return (filename.endswith('_unittest.py') or filename.endswith('_test.py'))
return filename.endswith('_unittest.py')


def is_valid_filename(f):
Expand Down
26 changes: 8 additions & 18 deletions utils/unittest_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@

REQUIRES_DJANGO = set((
'monitor_db_unittest.py',
'monitor_db_functional_test.py',
'monitor_db_cleanup_test.py',
'monitor_db_functional_unittest.py',
'monitor_db_cleanup_unittest.py',
'frontend_unittest.py',
'csv_encoder_unittest.py',
'rpc_interface_unittest.py',
'models_test.py',
'models_unittest.py',
'scheduler_models_unittest.py',
'metahost_scheduler_unittest.py',
'site_metahost_scheduler_unittest.py',
'rpc_utils_unittest.py',
'site_rpc_utils_unittest.py',
'execution_engine_unittest.py',
'service_proxy_lib_test.py',
'service_proxy_lib_unittest.py',
))

REQUIRES_MYSQLDB = set((
Expand All @@ -49,37 +49,27 @@
))

REQUIRES_SIMPLEJSON = set((
'resources_test.py',
'resources_unittest.py',
'serviceHandler_unittest.py',
))

REQUIRES_AUTH = set ((
'trigger_unittest.py',
))

REQUIRES_HTTPLIB2 = set((
))

REQUIRES_PROTOBUFS = set((
'job_serializer_unittest.py',
))

LONG_RUNTIME = set((
'base_barrier_unittest.py',
'logging_manager_test.py',
))

# This particular KVM autotest test is not a unittest
SKIP = set((
'guest_test.py',
'dd_test.py',
'logging_manager_unittest.py',
))

LONG_TESTS = (REQUIRES_DJANGO |
REQUIRES_MYSQLDB |
REQUIRES_GWT |
REQUIRES_SIMPLEJSON |
REQUIRES_HTTPLIB2 |
REQUIRES_AUTH |
REQUIRES_PROTOBUFS |
LONG_RUNTIME)
Expand Down Expand Up @@ -117,7 +107,7 @@ def run_test(mod_names, options):
def scan_for_modules(start, options):
modules = []

skip_tests = SKIP
skip_tests = []
if options.skip_tests:
skip_tests.update(options.skip_tests.split())

Expand All @@ -136,7 +126,7 @@ def scan_for_modules(start, options):

# Look for unittest files.
for fname in filenames:
if fname.endswith('_unittest.py') or fname.endswith('_test.py'):
if fname.endswith('_unittest.py'):
if not options.full and fname in LONG_TESTS:
continue
if fname in skip_tests:
Expand Down

0 comments on commit 6e4d808

Please sign in to comment.