MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_pathlike_objects

Method test_pathlike_objects

Lib/test/test_logging.py:660–680  ·  view source on GitHub ↗

Test that path-like objects are accepted as filename arguments to handlers. See Issue #27493.

(self)

Source from the content-addressed store, hash-verified

658 h.close()
659
660 def test_pathlike_objects(self):
661 """
662 Test that path-like objects are accepted as filename arguments to handlers.
663
664 See Issue #27493.
665 """
666 fn = make_temp_file()
667 os.unlink(fn)
668 pfn = os_helper.FakePath(fn)
669 cases = (
670 (logging.FileHandler, (pfn, 'w')),
671 (logging.handlers.RotatingFileHandler, (pfn, 'a')),
672 (logging.handlers.TimedRotatingFileHandler, (pfn, 'h')),
673 )
674 if sys.platform in ('linux', 'android', 'darwin'):
675 cases += ((logging.handlers.WatchedFileHandler, (pfn, 'w')),)
676 for cls, args in cases:
677 h = cls(*args, encoding="utf-8")
678 self.assertTrue(os.path.exists(fn))
679 h.close()
680 os.unlink(fn)
681
682 @unittest.skipIf(os.name == 'nt', 'WatchedFileHandler not appropriate for Windows.')
683 @unittest.skipIf(

Callers

nothing calls this directly

Calls 6

make_temp_fileFunction · 0.85
assertTrueMethod · 0.80
clsClass · 0.50
unlinkMethod · 0.45
existsMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected