Skip to content

Commit 3471e17

Browse files
committed
Add simple tests
1 parent 86714e7 commit 3471e17

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ doc:
1818
cd docs && make html
1919

2020
test:
21-
$(PYTHON) -m unittest discover -s test
21+
$(PYTHON) -m unittest discover -s tests
2222

2323
format:
2424
$(FORMATTER) spotify

tests/test_import.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import sys
2+
import importlib
3+
import unittest
4+
from types import ModuleType
5+
6+
7+
class TestImporting(unittest.TestCase):
8+
def _import(self, name: str) -> ModuleType:
9+
module = importlib.import_module(name)
10+
11+
try:
12+
sys.modules.pop(name)
13+
finally:
14+
del module
15+
16+
def test_import(self):
17+
self._import('spotify')
18+
19+
def test_import_sync(self):
20+
self._import('spotify.sync')
21+
22+
if __name__ == '__main__':
23+
unittest.main()

0 commit comments

Comments
 (0)