byroot / pysrt

Python parser for SubRip (srt) files
GNU General Public License v3.0
451 stars 69 forks source link

Tests fail with Python 3.12 #92

Closed jorti closed 1 year ago

jorti commented 1 year ago

When testing pysrt with Python 3.12.0a3, several tests fail because many deprecated unittest features are removed in 3.12:


======================================================================
ERROR: test_junk_after_timestamp (tests.test_srtitem.TestSerialAndParsing.test_junk_after_timestamp)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/pysrt-1.1.2/tests/test_srtitem.py", line 210, in test_junk_after_timestamp
    self.assertEquals(item, self.item)
    ^^^^^^^^^^^^^^^^^
AttributeError: 'TestSerialAndParsing' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

======================================================================
ERROR: test_no_index (tests.test_srtitem.TestSerialAndParsing.test_no_index)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/pysrt-1.1.2/tests/test_srtitem.py", line 205, in test_no_index
    self.assertEquals(item.index, None)
    ^^^^^^^^^^^^^^^^^
AttributeError: 'TestSerialAndParsing' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

======================================================================
ERROR: test_string_index (tests.test_srtitem.TestSerialAndParsing.test_string_index)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/pysrt-1.1.2/tests/test_srtitem.py", line 200, in test_string_index
    self.assertEquals(item.index, 'foo')
    ^^^^^^^^^^^^^^^^^
AttributeError: 'TestSerialAndParsing' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

======================================================================
ERROR: test_missing_indexes (tests.test_srtfile.TestIntegration.test_missing_indexes)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/pysrt-1.1.2/tests/test_srtfile.py", line 254, in test_missing_indexes
    self.assertEquals(len(items), 7)
    ^^^^^^^^^^^^^^^^^
AttributeError: 'TestIntegration' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

======================================================================
ERROR: test_at (tests.test_srtfile.TestSlice.test_at)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/pysrt-1.1.2/tests/test_srtfile.py", line 120, in test_at
    self.assertEquals(len(self.file.at((0, 0, 31, 0))), 1)
    ^^^^^^^^^^^^^^^^^
AttributeError: 'TestSlice' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

======================================================================
ERROR: test_multiple_item (tests.test_srtfile.TestText.test_multiple_item)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/pysrt-1.1.2/tests/test_srtfile.py", line 147, in test_multiple_item
    self.assertEquals(srt_file.text, 'Hello\nWorld !')
    ^^^^^^^^^^^^^^^^^
AttributeError: 'TestText' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

======================================================================
ERROR: test_single_item (tests.test_srtfile.TestText.test_single_item)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/pysrt-1.1.2/tests/test_srtfile.py", line 140, in test_single_item
    self.assertEquals(srt_file.text, 'Hello')
    ^^^^^^^^^^^^^^^^^
AttributeError: 'TestText' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

See: https://docs.python.org/3.12/whatsnew/3.12.html#removed

This was reported downstream in Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=2155245

byroot commented 1 year ago

Duplicate of #90

byroot commented 1 year ago

Hum, so I've been trying to push a new release for a while now, but I can't figure out why it's no longer working.

Writing pysrt-1.1.3/setup.cfg
Creating tar archive
removing 'pysrt-1.1.3' (and everything under it)
running upload
Submitting dist/pysrt-1.1.3.tar.gz to https://upload.pypi.org/legacy/
Upload failed (403): Invalid or non-existent authentication information. See https://pypi.org/help/#invalid-auth for more information.
error: Upload failed (403): Invalid or non-existent authentication information. See https://pypi.org/help/#invalid-auth for more information.

I'm trying to use token auth, I followed the instruction closely but still no luck.

I haven't touched Python in a very long time, so maybe there's something I don't know. If you have any idea let me know.