Open maxeval opened 1 year ago
okay let me have a look at it.
@keenborder786
Alright, described above problem occurs when I try to use a bot as a separate django app and ORM inside of it respectively: looks like django closes the thread if there is a call to db using standard django procedure - HTTP request; once it is something different (e.g. errbot separate runner with their own threads) it cannot close the thread.. Decided to move the errbot to a separate docker container to make communication with django BE via HTTP.
However, tests are still failing if I try to use the official errbot docs: the thing is, it cannot find the attribute:
AttributeError: 'TestClass' object has no attribute 'bot_thread'
The following plug helped to solve the issue:
from errbot.backends.test import FullStackTest
supportbot_plugins_dir = "plugins"
class TestBot(FullStackTest):
def __init__(self, *args, **kwargs) -> None:
self.bot_thread = None
super().__init__(*args, **kwargs)
def setUp(self, **kwargs) -> None:
super().setUp(extra_plugin_dir=supportbot_plugins_dir, loglevel=logging.ERROR, **kwargs)
Thanks in advance! Kindest regards!
Describe the bug Followed the instructions per official docs for testing, both options with using
pytest
with function based tests / orunittest
withFullStackTest
class are failing (instruction for usage ofFullStackTest
is taken from the class docstring). By failing means test env runner doesn't quit after all the tests are run (apparently due toThreads
are not closed properly, becausepostgresql
sometimes throws an error that there are several connections todb
that is not closed).To Reproduce Follow the instructions of the official docs
Expected behavior Test env run all the tests and quits.
Screenshots See traceback below.
Environment (please complete the following information):
Additional context After running the test, test env runner is not closed automatically (it simply freezes), once you Ctrl+C, the following traceback is appeared:
Here is a traceback that occurs in CI/CD pipeline (see below):
This problem occurs on both
unittest
(with usage ofFullStackTest
cls) andpytest
(using func based tests) runner.