mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
Merge pull request #3026 from florealcab/master
Use asyncio from redis instead of aioredis to make app python 3.11 compatible
This commit is contained in:
@@ -71,7 +71,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
database: ['postgres', 'mysql']
|
||||
python-version: [3.8, 3.9, '3.10']
|
||||
python-version: [3.8, 3.9, '3.10', '3.11']
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
|
||||
@@ -8,7 +8,7 @@ import logging
|
||||
|
||||
import aiosmtplib
|
||||
from dateutil.relativedelta import relativedelta
|
||||
import aioredis
|
||||
from redis import asyncio as aioredis
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import connections
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"""Policy daemon related tests."""
|
||||
|
||||
import asyncio
|
||||
# from mock import patch
|
||||
from asynctest import patch
|
||||
from aiosmtplib import send
|
||||
from unittest.mock import AsyncMock
|
||||
from multiprocessing import Process
|
||||
import socket
|
||||
import time
|
||||
@@ -57,8 +57,7 @@ class PolicyDaemonTestCase(
|
||||
self.admin.role = "SuperAdmins"
|
||||
|
||||
db.connections.close_all()
|
||||
patcher = patch("aiosmtplib.send")
|
||||
self.send_mock = patcher.start()
|
||||
self.send_mock = AsyncMock(send)
|
||||
self.process = Process(target=start_policy_daemon)
|
||||
self.process.daemon = True
|
||||
self.process.start()
|
||||
@@ -200,8 +199,7 @@ sasl_username=user@test.com
|
||||
await policyd_core.reset_counters()
|
||||
|
||||
# Run the async test
|
||||
coro = asyncio.coroutine(run_test)
|
||||
event_loop.run_until_complete(coro())
|
||||
event_loop.run_until_complete(run_test())
|
||||
event_loop.close()
|
||||
|
||||
self.assertEqual(
|
||||
|
||||
+1
-2
@@ -32,12 +32,11 @@ lxml
|
||||
chardet
|
||||
ovh
|
||||
oath
|
||||
redis
|
||||
redis>=4.2.0rc1
|
||||
rrdtool>=0.1.10
|
||||
qrcode
|
||||
|
||||
aiosmtplib
|
||||
aioredis==2.0.1
|
||||
|
||||
# PDF credentials
|
||||
reportlab
|
||||
|
||||
@@ -3,4 +3,3 @@ factory-boy<3.3.0
|
||||
httmock==1.4.0
|
||||
testfixtures==7.1.0
|
||||
tox
|
||||
asynctest
|
||||
|
||||
Reference in New Issue
Block a user