Skip to content

Commit

Permalink
Add testing data and more acceptance tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Nephin committed Feb 13, 2014
1 parent 61664ce commit 3bf6de8
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
22 changes: 21 additions & 1 deletion test/test_program_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ def test_parse_test_runner_command_line_args_no_test_path(self):

def test_call(command):
proc = subprocess.Popen(command, stdout=subprocess.PIPE)
stdout, _stderr = proc.communicate()
stdout, stderr = proc.communicate()
if proc.returncode:
raise subprocess.CalledProcessError(proc.returncode, command)
return stdout.strip()


Expand Down Expand Up @@ -81,3 +83,21 @@ def test_run_testify_test_module(self):
def test_run_testify_test_file(self):
output = test_call(['python', 'testing_suite/example_test.py', '-v'])
assert_in(self.expected_tests, output)

def test_run_testify_test_file_class(self):
output = test_call([
'python', 'testing_suite/example_test.py', '-v',
'ExampleTestCase'])
assert_in('PASSED. 2 tests', output)

def test_run_testify_test_file_class_and_method(self):
output = test_call([
'python', 'testing_suite/example_test.py', '-v',
'ExampleTestCase.test_one'])
assert_in('PASSED. 1 test', output)

def test_run_testify_with_failure(self):
assert_raises(
subprocess.CalledProcessError,
test_call,
['python', 'testing_suite/example_test.py', 'DoesNotExist'])
Empty file added testing_suite/__init__.py
Empty file.
21 changes: 21 additions & 0 deletions testing_suite/example_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

from testify import TestCase, run


class ExampleTestCase(TestCase):

def test_one(self):
pass

def test_two(self):
pass


class SecondTestCase(TestCase):

def test_one(self):
pass


if __name__ == "__main__":
run()

0 comments on commit 3bf6de8

Please sign in to comment.