From 3bf6de8a2fe461905b84d29d02c77968f6871c93 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Wed, 12 Feb 2014 16:38:01 -0800 Subject: [PATCH] Add testing data and more acceptance tests. --- test/test_program_test.py | 22 +++++++++++++++++++++- testing_suite/__init__.py | 0 testing_suite/example_test.py | 21 +++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 testing_suite/__init__.py create mode 100644 testing_suite/example_test.py diff --git a/test/test_program_test.py b/test/test_program_test.py index 1509cfa7..c3debc07 100644 --- a/test/test_program_test.py +++ b/test/test_program_test.py @@ -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() @@ -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']) diff --git a/testing_suite/__init__.py b/testing_suite/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/testing_suite/example_test.py b/testing_suite/example_test.py new file mode 100644 index 00000000..2c488614 --- /dev/null +++ b/testing_suite/example_test.py @@ -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()