diff --git a/pyglossary/glossary_v2.py b/pyglossary/glossary_v2.py index 571106699..371ff926b 100644 --- a/pyglossary/glossary_v2.py +++ b/pyglossary/glossary_v2.py @@ -1089,7 +1089,7 @@ def _resolveSortParams( self._switchToSQLite( inputFilename=args.inputFilename, ) - else: + elif not os.getenv("NO_SQLITE"): self._data = self._newInMemorySqEntryList() self._data.setSortKey( diff --git a/tests/g_stardict_sort_test.py b/tests/g_stardict_sort_test.py index 02772e890..f6916d6a2 100644 --- a/tests/g_stardict_sort_test.py +++ b/tests/g_stardict_sort_test.py @@ -1,3 +1,4 @@ +import os import unittest from g_stardict_test import TestGlossaryStarDictBase @@ -82,6 +83,11 @@ def test_convert_txt_stardict_enfa_4(self): ", and using sortKey function from Stardict plugin", ) + def test_convert_txt_stardict_enfa_5(self): + os.environ["NO_SQLITE"] = "1" + self.convert_txt_stardict_enfa("100-en-fa", sqlite=False) + del os.environ["NO_SQLITE"] + if __name__ == "__main__": unittest.main() diff --git a/tests/glossary_v2_test.py b/tests/glossary_v2_test.py index 14a866adc..d07a72c8b 100644 --- a/tests/glossary_v2_test.py +++ b/tests/glossary_v2_test.py @@ -304,6 +304,10 @@ def convert_txt_txt_sort(self, *args, **convertArgs): for sqlite in (None, True, False): self.convert_txt_txt(*args, sort=True, sqlite=sqlite, **convertArgs) + os.environ["NO_SQLITE"] = "1" + self.convert_txt_txt(*args, sort=True, sqlite=False, **convertArgs) + del os.environ["NO_SQLITE"] + class TestGlossary(TestGlossaryBase): def __init__(self, *args, **kwargs):