Skip to content

Commit

Permalink
tests: add SKIP_MISSING env and some minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ilius committed Dec 29, 2024
1 parent 94efb2b commit be1c3d3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
4 changes: 0 additions & 4 deletions tests/g_aard2_slob_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

from glossary_v2_test import TestGlossaryBase

skip_module = False


class TestGlossarySlob(TestGlossaryBase):
def __init__(self, *args, **kwargs):
Expand All @@ -20,8 +18,6 @@ def __init__(self, *args, **kwargs):
)

def setUp(self):
if skip_module:
self.skipTest("module is skipped")
TestGlossaryBase.setUp(self)

def test_convert_txt_slob_1(self):
Expand Down
9 changes: 9 additions & 0 deletions tests/g_appledict_bin_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, join
Expand All @@ -11,6 +12,14 @@


class TestGlossaryAppleDictBin(TestGlossaryBase):
def setUp(self):
if os.getenv("SKIP_MISSING"):
try:
import biplist # noqa: F401
except ImportError:
self.skipTest("skipping module due to missing dependency: biplist")
TestGlossaryBase.setUp(self)

def __init__(self, *args, **kwargs):
TestGlossaryBase.__init__(self, *args, **kwargs)

Expand Down
4 changes: 0 additions & 4 deletions tests/g_ebook_epub2_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

from pyglossary.glossary_v2 import ConvertArgs, Glossary

skip_module = False


class TestGlossaryEPUB2(TestGlossaryBase):
def __init__(self, *args, **kwargs):
Expand All @@ -27,8 +25,6 @@ def __init__(self, *args, **kwargs):
)

def setUp(self):
if skip_module:
self.skipTest("module is skipped")
TestGlossaryBase.setUp(self)

def remove_toc_uid(self, data):
Expand Down
10 changes: 9 additions & 1 deletion tests/g_kobo_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import gzip
import os
import unittest

import marisa_trie # noqa: F401, to ensure it's installed
from glossary_v2_test import TestGlossaryBase


class TestGlossaryKobo(TestGlossaryBase):
def setUp(self):
if os.getenv("SKIP_MISSING"):
try:
import marisa_trie # noqa: F401
except ImportError:
self.skipTest("skipping module due to missing dependency: marisa_trie")
TestGlossaryBase.setUp(self)

def __init__(self, *args, **kwargs):
TestGlossaryBase.__init__(self, *args, **kwargs)
# self.dataFileCRC32.update({})
Expand Down
3 changes: 0 additions & 3 deletions tests/slob_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ def set_tag_value(filename: str, name: str, value: str) -> None:

class BaseTest(unittest.TestCase):
def setUp(self):
# if skip_module:
# self.skipTest("module is skipped")

self.tmpdir = tempfile.TemporaryDirectory(prefix="test")
self._writers = []

Expand Down

0 comments on commit be1c3d3

Please sign in to comment.