Skip to content

Commit 8effe30

Browse files
committed
add test for #182
1 parent 87e1df3 commit 8effe30

File tree

4 files changed

+29
-0
lines changed

4 files changed

+29
-0
lines changed

src/tests/runtests.py

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
# other test modules that import System.Windows.Forms
1919
# run first. They must not do module level import/AddReference()
2020
# of the System.Windows.Forms namespace.
21+
'test_suite',
2122
'test_event',
2223
'test_constructors',
2324
'test_enum',

src/tests/test_suite/__init__.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import unittest
2+
3+
__all__ = ['test_suite']
4+
5+
from .test_import import test_suite as import_tests
6+
7+
def test_suite():
8+
suite = unittest.TestSuite()
9+
suite.addTests((import_tests(),))
10+
return suite
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
import this_package_should_never_exist_ever

src/tests/test_suite/test_import.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import unittest
2+
3+
class ImportTests(unittest.TestCase):
4+
"""Test the import statement."""
5+
6+
def testRealtiveMissingImport(self):
7+
"""Test that a relative missing import doesn't crash. Some modules use this to check if a package is installed (realtive import in the site-packages folder"""
8+
try:
9+
from . import _missing_import
10+
except ImportError:
11+
pass
12+
13+
14+
def test_suite():
15+
return unittest.makeSuite(ImportTests)
16+

0 commit comments

Comments
 (0)