mCaptcha-cache/tests/test.py

54 lines
1.4 KiB
Python
Raw Normal View History

#!/bin/env /usr/bin/python3
2021-06-06 09:10:30 +03:00
#
# Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
2021-06-06 14:32:02 +03:00
import asyncio
2021-06-05 14:26:35 +03:00
from time import sleep
from redis.client import Redis
from redis import BlockingConnectionPool
2021-06-06 09:10:30 +03:00
import utils
from runner import Runner
import bucket
2021-06-05 14:26:35 +03:00
2021-06-06 09:10:30 +03:00
REDIS_URL = "redis://localhost:6350"
2021-06-06 08:39:37 +03:00
2021-06-06 09:10:30 +03:00
r = utils.connect(REDIS_URL)
utils.ping(r)
2021-06-06 08:39:37 +03:00
2021-06-06 14:32:02 +03:00
async def main():
#runner = Runner()
#fn = [bucket.incr_one_works]#, bucket.race_works]
2021-06-06 08:39:37 +03:00
2021-06-06 14:32:02 +03:00
task1 = asyncio.create_task(bucket.incr_one_works())
task2 = asyncio.create_task(bucket.race_works())
await task1
await task2
2021-06-06 08:39:37 +03:00
#try:
# for r in fn:
# runner.register(r)
2021-06-05 14:26:35 +03:00
# runner.wait()
# print("All tests passed")
#except Exception as e:
# raise e
2021-06-05 14:26:35 +03:00
if __name__ == "__main__":
2021-06-06 14:32:02 +03:00
asyncio.run(main())