File: test_gc.py

package info (click to toggle)
python-hiredis 2.3.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 592 kB
  • sloc: ansic: 7,763; python: 382; makefile: 8
file content (17 lines) | stat: -rw-r--r-- 351 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import gc

import hiredis


def test_reader_gc():
    class A:
        def __init__(self):
            self.reader = hiredis.Reader(replyError=self.reply_error)

        def reply_error(self, error):
            return Exception()

    A()
    gc.collect()

    assert not any(isinstance(o, A) for o in gc.get_objects()), "Referent was not collected"