Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Print System.__file__ if assertion fails
  • Loading branch information
abessen committed Oct 27, 2016
commit b9e532d800177054dc2504e5669fe07bb4e59e2b
3 changes: 2 additions & 1 deletion src/tests/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ def testModuleInterface(self):
self.assertEquals(type(System.__dict__), type({}))
self.assertEquals(System.__name__, 'System')
# the filename can be any module from the System namespace (eg System.Data.dll or System.dll)
self.assertTrue(fnmatch(System.__file__, "*System*.dll"))
self.assertTrue(fnmatch(System.__file__, "*System*.dll"),
"unexpected System.__file__" + System.__file__)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ArvidJB can you add a comment why this was added in test?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The System namespace is spread out across a couple of DLLs: mscorlib.dll, System.dll, and all the other System.*.dlls. In ModuleObject we iterate through all the known assemblies for a namespace and pick the last one for the filename. The iteration order would be the on the hash of the assembly, so it should have always been unpredictable whether you get mscorlib.dll or one of the others.
Let me change the test such that mscorlib.dll is also accepted.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS: I added the error message because I could not reproduce this on my machine and wanted to know what value it got in the integration tests.

self.assertTrue(System.__doc__.startswith("Namespace containing types from the following assemblies:"))
self.assertTrue(self.isCLRClass(System.String))
self.assertTrue(self.isCLRClass(System.Int32))
Expand Down