miurahr / py7zr

7zip in python3 with ZStandard, PPMd, LZMA2, LZMA1, Delta, BCJ, BZip2, and Deflate compressions, and AES encryption.

Home Page:https://pypi.org/project/py7zr/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some test cases use deprecated functions

miurahr opened this issue · comments

Describe the bug

Some test case uses deprecated functions

Related issue

To Reproduce
Run test on python 3.12. We can observe warning

tests/test_archive.py::test_compress_single_encoded_header
  /home/miurahr/Projects/Python/py7zr/tests/test_archive.py:46: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
    mtime = datetime.utcfromtimestamp(pathlib.Path(os.path.join(testdata_path, "test1.txt")).stat().st_mtime)

tests/test_archive.py::test_compress_file_0
  /home/miurahr/Projects/Python/py7zr/tests/test_archive.py:174: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
    mtime = datetime.utcfromtimestamp(pathlib.Path(os.path.join(testdata_path, "test1.txt")).stat().st_mtime)

tests/test_extract.py::test_asyncio_executor
  /home/miurahr/Projects/Python/py7zr/tests/test_extract.py:428: DeprecationWarning: There is no current event loop
    loop = asyncio.get_event_loop()

Expected behavior
No warning is observed

Environment (please complete the following information):

  • OS: Mint Linux 21.2
  • Python 3.12
  • py7zr version: 7cacd64 on master

Test data(please attach in the report):

Additional context