FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Assemblymanager thread safety by ArvidJB · Pull Request #277 · pythonnet/pythonnet · GitHub

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Back | FazBrowse Home | New Git URL