MCPcopy Index your code
hub / github.com/python/cpython / test_timestamp_overflow

Method test_timestamp_overflow

Lib/test/test_import/__init__.py:665–688  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

663
664 @skip_if_dont_write_bytecode
665 def test_timestamp_overflow(self):
666 # A modification timestamp larger than 2**32 should not be a problem
667 # when importing a module (issue #11235).
668 sys.path.insert(0, os.curdir)
669 try:
670 source = TESTFN + ".py"
671 compiled = importlib.util.cache_from_source(source)
672 with open(source, 'w', encoding='utf-8') as f:
673 pass
674 try:
675 os.utime(source, (2 ** 33 - 5, 2 ** 33 - 5))
676 except OverflowError:
677 self.skipTest("cannot set modification time to large integer")
678 except OSError as e:
679 if e.errno not in (getattr(errno, 'EOVERFLOW', None),
680 getattr(errno, 'EINVAL', None)):
681 raise
682 self.skipTest("cannot set modification time to large integer ({})".format(e))
683 __import__(TESTFN)
684 # The pyc file was created.
685 os.stat(compiled)
686 finally:
687 del sys.path[0]
688 remove_files(TESTFN)
689
690 def test_bogus_fromlist(self):
691 try:

Callers

nothing calls this directly

Calls 8

__import__Function · 0.85
remove_filesFunction · 0.85
utimeMethod · 0.80
skipTestMethod · 0.80
openFunction · 0.50
insertMethod · 0.45
formatMethod · 0.45
statMethod · 0.45

Tested by

no test coverage detected