File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 66import string
77import subprocess
88import sys
9+ from packaging .version import Version
910from typing import Any
1011import pytest
1112
@@ -73,12 +74,18 @@ def cothread_ioc():
7374
7475
7576def aioca_cleanup ():
76- from aioca import purge_channel_caches , _catools
77+ from aioca import purge_channel_caches , _catools , __version__
7778 # Unregister the aioca atexit handler as it conflicts with the one installed
7879 # by cothread. If we don't do this we get a seg fault. This is not a problem
7980 # in production as we won't mix aioca and cothread, but we do mix them in
8081 # the tests so need to do this.
81- atexit .unregister (_catools ._Context ._destroy_context )
82+ # In aioca 1.8 the name of the cleanup function changed.
83+ if Version (__version__ ) >= Version ("1.8" ):
84+ unregister_func = _catools ._Context ._teardown
85+ else :
86+ unregister_func = _catools ._Context ._destroy_context
87+
88+ atexit .unregister (unregister_func )
8289 # purge the channels before the event loop goes
8390 purge_channel_caches ()
8491
You can’t perform that action at this time.
0 commit comments