Skip to content

Commit 9737ae9

Browse files
committed
Add tests for default theme locales
1 parent 5616103 commit 9737ae9

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/test_themes.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import glob
2+
import os
3+
import unittest
4+
import uuid
5+
from unittest import mock
6+
7+
from webscrapbook import util
8+
9+
from . import PROG_DIR
10+
11+
12+
def setUpModule():
13+
# mock out user config
14+
global mockings
15+
mockings = (
16+
mock.patch('webscrapbook.Config.user_config_dir', return_value=os.devnull),
17+
)
18+
for mocking in mockings:
19+
mocking.start()
20+
21+
22+
def tearDownModule():
23+
# stop mock
24+
for mocking in mockings:
25+
mocking.stop()
26+
27+
28+
class TestThemesDefault(unittest.TestCase):
29+
def test_locales(self):
30+
locales_dir = os.path.join(PROG_DIR, 'themes', 'default', 'locales')
31+
for file in glob.iglob(os.path.join(glob.escape(locales_dir), '**', '*.py'), recursive=True):
32+
util.import_module_file(f'webscrapbook._test_themes_default_locale_{uuid.uuid4()}', file)

0 commit comments

Comments
 (0)