Skip to content
This repository has been archived by the owner on Mar 1, 2018. It is now read-only.

Commit

Permalink
Adding submodule specificity to testing
Browse files Browse the repository at this point in the history
Now you can name which submodule you want to test, if none is chosen all
tests run
  • Loading branch information
jtemporal committed May 22, 2017
1 parent 247a2db commit 40e1de3
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions rosie.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ def entered_command(argv):

def help():
message = (
'Usages:',
'Usage:',
' python rosie.py run chamber_of_deputies [<path to output directory>]',
'Testing:',
' python rosie.py test',
' python rosie.py test chamber_of_deputies',
)
print('\n'.join(message))

Expand All @@ -30,11 +32,21 @@ def run():


def test():
import os
import unittest

loader = unittest.TestLoader()
tests = loader.discover('rosie')

if len(argv) >= 3:
target_module = argv[2]
tests_path = os.path.join('rosie', target_module)
tests = loader.discover(tests_path)
else:
tests = loader.discover('rosie')

testRunner = unittest.runner.TextTestRunner()
result = testRunner.run(tests)

if not result.wasSuccessful():
exit(1)

Expand Down

0 comments on commit 40e1de3

Please sign in to comment.