def test_analysis_should_return_true_when_oserror(self): self.given_a_file_in_test_dir('valid.pt', VALID_CODE) # The options are fake, so the function should raise an OSError # but return True. self.options['zptlint-bin'] = '' with OutputCapture(): self.assertTrue(ZPTLint(self.options).run())
def test_analysis_file_should_exist_when_jenkins_is_true(self): self.given_a_file_in_test_dir('valid.pt', VALID_CODE) parts_dir = mkdtemp() self.options['location'] = parts_dir self.options['jenkins'] = 'True' # need to activate jenkins. with OutputCapture(): ZPTLint(self.options).run() file_exists = os.path.isfile(os.path.join(parts_dir, 'zptlint.log')) rmtree(parts_dir) self.assertTrue(file_exists)
def test_analysis_should_return_true(self): self.given_a_file_in_test_dir('valid.pt', VALID_CODE) with OutputCapture(): self.assertTrue(ZPTLint(self.options).run())
def test_analysis_should_return_false_when_error_found(self): self.given_a_file_in_test_dir('invalid.pt', INVALID_CODE) with OutputCapture(): self.assertFalse(ZPTLint(self.options).run())