Skip to content

Commit

Permalink
allow for selection of specific modules to test
Browse files Browse the repository at this point in the history
  • Loading branch information
talos committed Feb 27, 2017
1 parent b9126db commit 8db175b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ etl-unittest:
etl-metadatatest:
docker-compose run --rm bigmetadata /bin/bash -c \
'while : ; do pg_isready -t 1 && break; done && \
PGDATABASE=test nosetests -v \
TEST_MODULE=tasks.$(MODULE) PGDATABASE=test nosetests -v \
tests/test_metadata.py'

travis-etl-unittest:
Expand Down
20 changes: 1 addition & 19 deletions tests/test_metadata.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from tests.util import runtask, setup, teardown, collect_tasks

from tasks.util import TableTask

# Monkeypatch TableTask
TableTask._test = True

Expand All @@ -12,25 +13,6 @@
from nose.tools import assert_greater, with_setup


# {
# 'geo': ['state', 'zcta', 'tract'],
# 'table': ['B01', 'B02', 'B03', 'B04']
# }

# [{'geo': 'state', 'table': 'B01'},
# {'geo': 'zcta', 'table': 'B01'},
# {'geo': 'tract', 'table': 'B01'},
# {'geo': 'state', 'table': 'B02'},
# {'geo': 'zcta', 'table': 'B02'},
# {'geo': 'tract', 'table': 'B02'},
# {'geo': 'state', 'table': 'B03'},
# {'geo': 'zcta', 'table': 'B03'},
# {'geo': 'tract', 'table': 'B03'},
# {'geo': 'state', 'table': 'B04'},
# {'geo': 'zcta', 'table': 'B04'},
# {'geo': 'tract', 'table': 'B04'}]


def cross(orig_list, b_name, b_list):
result = []
for orig_dict in orig_list:
Expand Down
3 changes: 3 additions & 0 deletions tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,11 @@ def collect_tasks(TaskClass):
Returns a set of task classes whose parent is the passed `TaskClass`
'''
tasks = set()
test_module = os.environ.get('TEST_MODULE', '').replace('.', os.path.sep)
for dirpath, _, files in os.walk('tasks'):
for filename in files:
if not os.path.join(dirpath, filename).startswith(test_module):
continue
if filename.endswith('.py'):
modulename = '.'.join([
dirpath.replace(os.path.sep, '.'),
Expand Down

0 comments on commit 8db175b

Please sign in to comment.