Skip to content

Commit

Permalink
fix failing tests by adding env var CALC_FILE_SIZE
Browse files Browse the repository at this point in the history
  • Loading branch information
ilius committed Feb 6, 2025
1 parent 7a9743b commit 26315f7
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pyglossary/text_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ def _openGen(self, filename: str) -> Iterator[tuple[int, int]]:
self._calcFilzeSize(cfile, filename)
self._progress = self._fileSize > 0
else:
if os.environ.get("CALC_FILE_SIZE"):
self._calcFilzeSize(cfile, filename)
self._progress = False

self._file = TextFilePosWrapper(cfile, self._encoding)
Expand Down
1 change: 1 addition & 0 deletions tests/deprecated/glossary_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def __init__(self, *args, **kwargs):
"res/stardict.png": "7e1447fa",
"res/test.json": "41f8cf31",
}
os.environ["CALC_FILE_SIZE"] = "1"

def addDirCRC32(self, dirPath: str, files: "dict[str, str]") -> None:
for fpath, _hash in files.items():
Expand Down
2 changes: 2 additions & 0 deletions tests/g_csv_plugin_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import sys
import unittest
from os.path import abspath, dirname
Expand All @@ -20,6 +21,7 @@ def __init__(self, *args, **kwargs):
"100-ja-en.csv": "7af18cf3",
},
)
os.environ["CALC_FILE_SIZE"] = "1"

def convert_txt_csv(self, fname, fname2, **convertArgs):
self.convert(
Expand Down
2 changes: 2 additions & 0 deletions tests/g_dict_org_source_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import unittest

from glossary_v2_test import TestGlossaryBase
Expand All @@ -12,6 +13,7 @@ def __init__(self, *args, **kwargs):
"100-en-fa.dtxt": "05d6e939",
},
)
os.environ["CALC_FILE_SIZE"] = "1"

def convert_txt_dict_org_source(self, fname, fname2, **convertArgs):
self.convert(
Expand Down
2 changes: 2 additions & 0 deletions tests/g_dictunformat_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import unittest

from glossary_v2_test import TestGlossaryBase
Expand All @@ -13,6 +14,7 @@ def __init__(self, *args, **kwargs):
"100-en-fa-2.dictunformat.txt": "c88207ec",
},
)
os.environ["CALC_FILE_SIZE"] = "1"

def convert_dictunformat_txt(self, fname, fname2, **convertArgs):
self.convert(
Expand Down
2 changes: 2 additions & 0 deletions tests/g_gettext_po_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import sys
import unittest
from os.path import abspath, dirname
Expand All @@ -18,6 +19,7 @@ def __init__(self, *args, **kwargs):
"100-en-fa.po.txt": "f0c3ea53",
},
)
os.environ["CALC_FILE_SIZE"] = "1"

def convert_txt_po(self, fname, fname2, **convertArgs):
self.convert(
Expand Down
1 change: 1 addition & 0 deletions tests/g_jmdict_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def __init__(self, *args, **kwargs):
"050-JMdict-English-v3.txt": "6068b9a7",
},
)
# os.environ["CALC_FILE_SIZE"] = "1"

def convert_jmdict_txt(self, fname, fname2, **convertArgs):
self.convert(
Expand Down
2 changes: 2 additions & 0 deletions tests/g_sql_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import unittest

from glossary_v2_test import TestGlossaryBase
Expand All @@ -13,6 +14,7 @@ def __init__(self, *args, **kwargs):
"100-en-fa.txt-v2.sql": "70cd0514",
},
)
os.environ["CALC_FILE_SIZE"] = "1"

def convert_txt_sql(self, fname, fname2, **convertArgs):
self.convert(
Expand Down
2 changes: 2 additions & 0 deletions tests/g_wiktextract_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import sys
import unittest
from os.path import abspath, dirname
Expand All @@ -24,6 +25,7 @@ def __init__(self, *args, **kwargs):
"wiktextract/03-kaikki-fa-selection.txt": "f54d1a97",
},
)
os.environ["CALC_FILE_SIZE"] = "1"

def convert_jsonl_txt(self, fname, fname2, **convertArgs):
self.convert(
Expand Down
1 change: 1 addition & 0 deletions tests/glossary_v2_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def __init__(self, *args, **kwargs):
"res/stardict.png": "7e1447fa",
"res/test.json": "41f8cf31",
}
os.environ["CALC_FILE_SIZE"] = "1"

def addDirCRC32(self, dirPath: str, files: "dict[str, str]") -> None:
for fpath, _hash in files.items():
Expand Down

0 comments on commit 26315f7

Please sign in to comment.