diff --git a/test/test_program_test.py b/test/test_program_test.py index f89f6f9..5575c4e 100644 --- a/test/test_program_test.py +++ b/test/test_program_test.py @@ -56,9 +56,9 @@ def test_parse_test_runner_command_line_args_no_test_path(self): test_program.parse_test_runner_command_line_args([], []) -def test_call(command): - proc = subprocess.Popen(command, stdout=subprocess.PIPE) - stdout, stderr = proc.communicate() +def test_call(command, stdin=None): + proc = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE) + stdout, stderr = proc.communicate(stdin) if proc.returncode: raise subprocess.CalledProcessError(proc.returncode, command) return stdout.strip().decode('UTF-8') @@ -147,6 +147,23 @@ def test_rerun_discovery_txt(self): def test_rerun_discovery_json(self): self.assert_rerun_discovery('json') + def test_rerun_ignores_comments_and_blank_lines(self): + output = test_call( + (sys.executable, '-m', 'testify.test_program', '-v', '--rerun-test-file', '-'), + stdin=( + b'test.test_suites_test SubDecoratedTestCase.test_thing\n' + b'# ignore this\n' + b'\n' + b'test.test_suites_test SubTestCase.test_thing\n' + ), + ) + output = re.sub(r'\b[0-9.]+s\b', '${TIME}', output) + assert_equal(output, '''\ +test.test_suites_test SubDecoratedTestCase.test_thing ... ok in ${TIME} +test.test_suites_test SubTestCase.test_thing ... ok in ${TIME} + +PASSED. 2 tests / 2 cases: 2 passed, 0 failed. (Total test time ${TIME})''') + def test_run_testify_from_bin(self): output = test_call(['bin/testify', 'testing_suite', '-v']) assert_in(self.expected_tests, output) diff --git a/testify/test_rerunner.py b/testify/test_rerunner.py index b7fae8e..cd48c48 100644 --- a/testify/test_rerunner.py +++ b/testify/test_rerunner.py @@ -43,7 +43,7 @@ def discover(self): tests = [ constructor(test) for test in tests.splitlines() - if test # Skip blank lines + if test and not test.startswith('#') ] for class_path, tests in groupby(tests, lambda test: test[:2]): diff --git a/tox.ini b/tox.ini index dcb8241..32f67bc 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27,py34,py35 +envlist = py27,py37 [testenv] passenv = TERM