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/gating.yaml b/gating.yaml index 9e0ee4a..5447e28 100644 --- a/gating.yaml +++ b/gating.yaml @@ -3,4 +3,5 @@ product_versions: - rhel-8 decision_context: osci_compose_gate rules: - - !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional} \ No newline at end of file + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} + diff --git a/tests/plan.fmf b/tests/plan.fmf new file mode 100644 index 0000000..cfa484f --- /dev/null +++ b/tests/plan.fmf @@ -0,0 +1,12 @@ +environment: + PYTHON: /usr/libexec/platform-python + +discover: + how: fmf + +execute: + how: tmt + +prepare: + how: feature + crb: enabled diff --git a/tests/quick_start.fmf b/tests/quick_start.fmf new file mode 100644 index 0000000..822e595 --- /dev/null +++ b/tests/quick_start.fmf @@ -0,0 +1,10 @@ +test: | + trap cleanup EXIT + cleanup(){ + test -d indexdir && rm -rf indexdir + } + mkdir indexdir + ${PYTHON:-python3} quick_start.py + +require: +- python3-whoosh diff --git a/tests/quick_start.py b/tests/quick_start.py new file mode 100644 index 0000000..68f9500 --- /dev/null +++ b/tests/quick_start.py @@ -0,0 +1,20 @@ +# Based on +# https://whoosh.readthedocs.io/en/latest/quickstart.html#a-quick-introduction + +from whoosh.index import create_in +from whoosh.fields import * +schema = Schema(title=TEXT(stored=True), path=ID(stored=True), content=TEXT) +ix = create_in("indexdir", schema) +writer = ix.writer() +writer.add_document(title=u"First document", path=u"/a", + content=u"This is the first document we've added!") +writer.add_document(title=u"Second document", path=u"/b", + content=u"The second one is even more interesting!") +writer.commit() +from whoosh.qparser import QueryParser +with ix.searcher() as searcher: + query = QueryParser("content", ix.schema).parse("first") + results = searcher.search(query) + result = results[0] + + assert result.get('title') == 'First document'