Commit 88a51c84 88a51c84bd0c33ed68d28f11a6d53936e337f9f2 by Nicolas Perriault

fixed #404 - --fail-fast option was broken

1 parent ca0604c8
1 casper.test.begin('test 1', 1, function(test) {
2 test.assert(true);
3 test.done();
4 });
1 casper.test.begin('test 2', 1, function(test) {
2 test.assert(false);
3 test.done();
4 });
1 casper.test.begin('test 3', 1, function(test) {
2 test.assert(true);
3 test.done();
4 });
...@@ -54,6 +54,8 @@ class CasperExecTest(unittest.TestCase): ...@@ -54,6 +54,8 @@ class CasperExecTest(unittest.TestCase):
54 self.assertEquals(self.runCommand(cmd), result) 54 self.assertEquals(self.runCommand(cmd), result)
55 55
56 def assertCommandOutputContains(self, cmd, what, **kwargs): 56 def assertCommandOutputContains(self, cmd, what, **kwargs):
57 if not what:
58 raise AssertionError('Empty lookup')
57 if isinstance(what, (list, tuple)): 59 if isinstance(what, (list, tuple)):
58 for entry in what: 60 for entry in what:
59 self.assertIn(entry, self.runCommand(cmd, **kwargs)) 61 self.assertIn(entry, self.runCommand(cmd, **kwargs))
...@@ -149,5 +151,17 @@ class CasperExecTest(unittest.TestCase): ...@@ -149,5 +151,17 @@ class CasperExecTest(unittest.TestCase):
149 'assert: Subject is strictly true', 151 'assert: Subject is strictly true',
150 ], failing=True) 152 ], failing=True)
151 153
154 @timeout(60)
155 def test_fail_fast(self):
156 folder_path = os.path.join(TEST_ROOT, 'fail-fast')
157 self.assertCommandOutputContains('test %s --fail-fast' % folder_path, [
158 '# test 1',
159 '# test 2',
160 '--fail-fast: aborted all remaining tests',
161 'FAIL 2 tests executed',
162 '1 passed',
163 '1 failed',
164 ], failing=True)
165
152 if __name__ == '__main__': 166 if __name__ == '__main__':
153 unittest.main() 167 unittest.main()
......