From 54f1531139ffc4943010962995e0ac6291843627 Mon Sep 17 00:00:00 2001 From: Parag Nemade Date: Mon, 5 Aug 2024 11:08:18 +0530 Subject: [PATCH] Resolves:RHEL-52482 - Add conditional for RHEL for using hunspell directory Add tmt CI tests --- .fmf/version | 1 + hunspell-ga.spec | 10 +++++++++- plans/hunspell-ga.fmf | 5 +++++ tests/test_dic_availability.fmf | 6 ++++++ tests/test_dic_availability.py | 10 ++++++++++ tests/test_suggest_words.fmf | 6 ++++++ tests/test_suggest_words.py | 9 +++++++++ 7 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 .fmf/version create mode 100644 plans/hunspell-ga.fmf create mode 100644 tests/test_dic_availability.fmf create mode 100644 tests/test_dic_availability.py create mode 100644 tests/test_suggest_words.fmf create mode 100644 tests/test_suggest_words.py diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/hunspell-ga.spec b/hunspell-ga.spec index be3e9e9..d25c924 100644 --- a/hunspell-ga.spec +++ b/hunspell-ga.spec @@ -1,9 +1,13 @@ +%if 0%{?fedora} >= 36 || 0%{?rhel} > 9 %global dict_dirname hunspell +%else +%global dict_dirname myspell +%endif Name: hunspell-ga Summary: Irish hunspell dictionaries Version: 5.1 -Release: 6%{?dist} +Release: 7%{?dist} Source: https://github.com/kscanne/gaelspell/releases/download/v%{version}/hunspell-ga-%{version}.zip URL: https://cadhan.com/gaelspell/ License: GPL-2.0-or-later @@ -32,6 +36,10 @@ cp -p ga_IE.dic ga_IE.aff $RPM_BUILD_ROOT/%{_datadir}/%{dict_dirname} %{_datadir}/%{dict_dirname}/* %changelog +* Sun Aug 04 2024 Parag Nemade - 5.1-7 +- Resolves:RHEL-52482 - Add conditional for RHEL for using hunspell directory +- Add tmt CI tests + * Mon Jun 24 2024 Troy Dawson - 5.1-6 - Bump release for June 2024 mass rebuild diff --git a/plans/hunspell-ga.fmf b/plans/hunspell-ga.fmf new file mode 100644 index 0000000..c1627f9 --- /dev/null +++ b/plans/hunspell-ga.fmf @@ -0,0 +1,5 @@ +summary: Basic smoke test +discover: + how: fmf +execute: + how: tmt diff --git a/tests/test_dic_availability.fmf b/tests/test_dic_availability.fmf new file mode 100644 index 0000000..a216f43 --- /dev/null +++ b/tests/test_dic_availability.fmf @@ -0,0 +1,6 @@ +require: +- python3-enchant +- hunspell-ga +test: python3 test_dic_availability.py +framework: shell + diff --git a/tests/test_dic_availability.py b/tests/test_dic_availability.py new file mode 100644 index 0000000..7d90bfb --- /dev/null +++ b/tests/test_dic_availability.py @@ -0,0 +1,10 @@ +#!/usr/bin/python3 + +import enchant + +lang = "ga_IE" +try: + dic = enchant.request_dict(lang) + print("Dictionary for {0} language is available for use".format(lang)) +except enchant.errors.DictNotFoundError: + print("Dictionary is not installed for use") diff --git a/tests/test_suggest_words.fmf b/tests/test_suggest_words.fmf new file mode 100644 index 0000000..692e0b8 --- /dev/null +++ b/tests/test_suggest_words.fmf @@ -0,0 +1,6 @@ +require: +- python3-enchant +- hunspell-ga +test: python3 test_suggest_words.py +framework: shell + diff --git a/tests/test_suggest_words.py b/tests/test_suggest_words.py new file mode 100644 index 0000000..2db0325 --- /dev/null +++ b/tests/test_suggest_words.py @@ -0,0 +1,9 @@ +#!/usr/bin/python3 + +import enchant + +wdlst = [ "dhit", "ca", "maid"] +dic = enchant.Dict("ga_IE") +for wd in wdlst: + dic.check(wd) + print("input word = {0}, Suggestions => {1}".format(wd, dic.suggest(wd)))