[issue24263] unittest cannot load module whose name starts with Unicode
New submission from sih4sing5hong5: Because VALID_MODULE_NAME is r'[_a-z]\w*\.py$' in unittest/loader.py. Using r'[^\W\d]\w*\.py$' insteaded. -- keywords: +patch title: Why VALID_MODULE_NAME in unittest/loader.py is r'[_a-z]\w*\.py$' not r'\w+\.py$' ? -> unittest cannot load module whose name starts with Unicode Added file: http://bugs.python.org/file39778/VALID_MODULE_NAME.patch ___ Python tracker <http://bugs.python.org/issue24263> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24263] unittest cannot load module whose name starts with Unicode
sih4sing5hong5 added the comment: There is an attached file for examples. I ran {{{ cd test_dir python -m unittest -v }}} and got "Ran 1 test in 0.000s" -- Added file: http://bugs.python.org/file39779/test_dir.tar.gz ___ Python tracker <http://bugs.python.org/issue24263> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24263] unittest cannot load module whose name starts with Unicode
sih4sing5hong5 added the comment: By the way, I ran with Python 3.4.0. -- ___ Python tracker <http://bugs.python.org/issue24263> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24263] unittest cannot load module whose name starts with Unicode
Changes by sih4sing5hong5 : Removed file: http://bugs.python.org/file39778/VALID_MODULE_NAME.patch ___ Python tracker <http://bugs.python.org/issue24263> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24263] unittest cannot load module whose name starts with Unicode
sih4sing5hong5 added the comment: Thank you. I updated my patch in `VALID_MODULE_NAME.patch`. -- Added file: http://bugs.python.org/file39789/VALID_MODULE_NAME.patch ___ Python tracker <http://bugs.python.org/issue24263> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24263] unittest cannot load module whose name starts with Unicode
sih4sing5hong5 added the comment: update by adding `except AttributeError:` -- Added file: http://bugs.python.org/file39794/VALID_MODULE_NAME2.patch ___ Python tracker <http://bugs.python.org/issue24263> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24855] fail to mock the urlopen function
New submission from sih4sing5hong5: I also posted in stackoverflow: http://stackoverflow.com/questions/30978207/python-urlopen-mock-fail ``` from unittest.mock import patch import urllib from urllib import request from urllib.request import urlopen @patch('urllib.request.urlopen') def openPatch(urlopenMock): print(urlopenMock) print(urlopen) print(request.urlopen) print(urllib.request.urlopen) openPatch() ``` and got ``` ``` request.urlopen and urllib.request.urlopen worked. Why urlopen had been not mocked? -- components: Library (Lib) messages: 248500 nosy: sih4sing5hong5 priority: normal severity: normal status: open title: fail to mock the urlopen function versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6 ___ Python tracker <http://bugs.python.org/issue24855> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24855] fail to mock the urlopen function
sih4sing5hong5 added the comment: It is normal because of __all__ syntax. By: https://github.com/testing-cabal/mock/issues/313#issuecomment-130564364 -- status: open -> closed ___ Python tracker <http://bugs.python.org/issue24855> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24855] fail to mock the urlopen function
sih4sing5hong5 added the comment: I moved the import urlopen inside the patch. The mock worked. Thank you for explanations. I understand now. -- ___ Python tracker <http://bugs.python.org/issue24855> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24263] Why VALID_MODULE_NAME in unittest/loader.py is r'[_a-z]\w*\.py$' not r'\w+\.py$' ?
Changes by sih4sing5hong5 : -- components: Unicode nosy: ezio.melotti, haypo, sih4sing5hong5 priority: normal severity: normal status: open title: Why VALID_MODULE_NAME in unittest/loader.py is r'[_a-z]\w*\.py$' not r'\w+\.py$' ? type: behavior versions: Python 3.2, Python 3.3, Python 3.4 ___ Python tracker <http://bugs.python.org/issue24263> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com