8000 Added unit test for fix for #261 added .NET DLL with missing dependency · vmuriart/pythonnet@c623e3b · GitHub
[go: up one dir, main page]

Skip 8000 to content

Commit c623e3b

Browse files
Daniel Fernandezvmuriart
authored andcommitted
Added unit test for fix for pythonnet#261 added .NET DLL with missing dependency
1 parent ccb206f commit c623e3b

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import os
2+ DA10
import clr
3+
path_to_dll = os.path.join(os.path.dirname(__file__), "TestDependencyAssembly.dll")
4+
clr.AddReference(path_to_dll)
5+
from TestDependencyAssembly import TestDependency

src/tests/test_suite/test_import.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
def testMissingImportDepencency(self):
14+
missing_dependency_name = "MissingDependencyAssembly"
15+
with self.assertRaisesRegexp(ImportError, missing_dependency_name):
16+
from . import _missing_import_dependency
17+
18+
19+
20+
def test_suite():
21+
return unittest.makeSuite(ImportTests)
22+

0 commit comments

Comments
 (0)
0