Closed
Bug 891611
Opened 11 years ago
Closed 11 years ago
mozcrash unit tests don't appear to work on windows
Categories
(Testing :: Mozbase, defect)
Tracking
(Not tracked)
RESOLVED
INVALID
People
(Reporter: wlach, Unassigned)
Details
Or at least they don't for me, here's what I get when I run them: wlach@WLACH-WIN7-VM ~/mozbase (master) $ Scripts/python mozcrash/tests/test.py Traceback (most recent call last): File "mozcrash/tests/test.py", line 11, in <module> log = mozlog.getLogger("mozcrash", os.devnull) File "c:\users\wlach\mozbase\mozlog\mozlog\logger.py", line 107, in getLogger handler = FileHandler(logfile) File "c:\mozilla-build\python\Lib\logging\__init__.py", line 819, in __init__ StreamHandler.__init__(self, self._open()) File "c:\mozilla-build\python\Lib\logging\__init__.py", line 838, in _open stream = open(self.baseFilename, self.mode) IOError: [Errno 2] No such file or directory: '\\\\nul' It appears that the culprit is the redirection of the log to os.devnull, which doesn't exist on Windows: https://github.com/mozilla/mozbase/blob/master/mozcrash/tests/test.py#L10
Comment 1•11 years ago
|
||
I hadn't run the tests on Windows previously, but os.devnull works fine on Windows for me, and it seems to work okay with the logging module: $ python Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win 32 Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> os.devnull 'nul' >>> open(os.devnull, "w") <open file 'nul', mode 'w' at 0x0054B968> >>> import logging >>> fh = logging.FileHandler(os.devnull) >>> fh <logging.FileHandler object at 0x02013550> >>> log = logging.getLogger("foo") >>> log.addHandler(fh) >>> log.info("hello") >>> I just ran the tests on Windows and they seem fine here: $ ../ve-mozbase/Scripts/python.exe mozcrash/tests/test.py ........ ---------------------------------------------------------------------- Ran 8 tests in 0.544s OK
Reporter | ||
Comment 2•11 years ago
|
||
I was using an older version of mozilla-build with python 2.6. Updating to the latest version with python 2.7 fixes everything.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•