def test_integration(self, capsys): """Integration test for converting a test spec file.""" scl_test_spec_path = '{0}/test_data/scl_test.spec'.format(tests_dir) with open(scl_test_spec_path, 'r') as spec_file: expected = spec_file.read() main(args=[self.test_spec_path]) out, err = capsys.readouterr() assert out == expected
def test_supply_list_file(self, deps_file_content, expected_in_spec, tmpdir, capsys): """Test --list-file option.""" deps_file = tmpdir.mkdir("sub").join("deps") deps_file.write(deps_file_content) main(args=[self.test_spec_path, '--list-file={}'.format(deps_file)]) out, err = capsys.readouterr() assert expected_in_spec in out
def test_options_not_in_spec(self, args, not_in_spec, capsys): """Test that provided options are functional.""" main(args=[self.test_spec_path] + args) out, err = capsys.readouterr() assert not_in_spec not in out
def test_options_in_spec(self, args, in_spec, capsys): """Test that provided options are functional.""" main(args=args) out, err = capsys.readouterr() for element in in_spec: assert element in out
def test_expected_errors(self, args, expected_message, capsys): """Test tht expected errors are properly raised.""" with pytest.raises(SystemExit): main(args=args) out, err = capsys.readouterr() assert expected_message in out
def test_args_correctly_validated(self, args, expected_message, capsys): """Test that CLI arguments are properly validated.""" with pytest.raises(SystemExit): main(args=args) out, err = capsys.readouterr() assert expected_message in err