Skip to content

Comments

Fix DeprecationError when ussing assert_ since python 3.12#36

Open
mirespace wants to merge 2 commits intomitsuhiko:masterfrom
mirespace:use-assertTrue-python3-12
Open

Fix DeprecationError when ussing assert_ since python 3.12#36
mirespace wants to merge 2 commits intomitsuhiko:masterfrom
mirespace:use-assertTrue-python3-12

Conversation

@mirespace
Copy link

Dear Maintainer,

In Ubuntu we cannot build this package (FTBFS): since python3.12, the assert_ method no longer exists [1]. We could see a deprecation warning for this in previous builds, like this one for Focal [2]:

test_object_hook (tests.PhpSerializeTestCase) ... /<>/tests.py:92: DeprecationWarning: Please use assertTrue instead.
self.assert_(b'WP_User' in x)

In Debian, they still use Python3.11 (so they have the warning, not the error like us) [3].

I'm submitting here the change that we have already incorporated into the Ubuntu package for your awareness in case you find it useful.

Thanks in advance!

[1] https://docs.python.org/3/library/unittest.html#assert-methods
[2] https://launchpadlibrarian.net/448504127/buildlog_ubuntu-focal-amd64.python-phpserialize_1.3-1.1_BUILDING.txt.gz
[3] https://buildd.debian.org/status/fetch.php?pkg=python-phpserialize&arch=all&ver=1.3-2&stamp=1712878490&raw=0

As noted by bdrung, it will throw a better error message when needed.

Co-authored-by: Benjamin Drung <bdrung@ubuntu.com>
@jgarte
Copy link

jgarte commented Jun 12, 2025

Hi,

I also get this:

Traceback (most recent call last):
  File "/tmp/guix-build-python-phpserialize-1.3.drv-0/source/tests.py", line 35, in test_dumps_dict
    self.assertEqual(phpserialize.dumps({'a': 1, 'b': 2, 'c': 3}),
AssertionError: b'a:3:{s:1:"a";i:1;s:1:"b";i:2;s:1:"c";i:3;}' != b'a:3:{s:1:"a";i:1;s:1:"c";i:3;s:1:"b";i:2;}'

----------------------------------------------------------------------

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants