Ajit D'Sa and I have been working on some DB updates. Updated MongoDB, added a postgres, but also we could update SQLite.
The main reason is this:
Skills should be allowed to specify which table they save to.
Right now, one opsdroid instance with one DB, two different skills will save into the same table/collection of the same db.
So we allow:
getfunctions as an optional kwarg.
I do not know how to write good tests for this. Is there a way to spin up a postgres instance on commit and run unit tests against it? Or decent mock modules available?
Awesome thanks! I'm excited to see this work happening.
I'm curious about the desire to have different tables/collections for each skill. I've always considered it a feature that the opsdroid memory object is accessible from any skill. Each skill can just choose a prefix for the key name if there are concerns about collision.
pytest-dockerto start a postgres database as part of the pytest fixtures.
assert event.abc == "pyup-bot"and then run
pytest opsdroid/connector/github/tests/test_connector_github.py::test_pr_mergedit still passes. Any reason why this would be?
Exception when running skillis not logged once the skill has been run.
tryand then catch the exception coming back, yah? If not, lemme know if you can pseudocode it out for me, and I'll try making the change
caplogto the arguments here https://github.com/opsdroid/opsdroid/blob/a45490d1bdceca39b49880e20262b55ea0be101d/opsdroid/connector/github/tests/test_connector_github.py#L227
assert "Exception when running skill" not in caplog.texthere https://github.com/opsdroid/opsdroid/blob/a45490d1bdceca39b49880e20262b55ea0be101d/opsdroid/connector/github/tests/test_connector_github.py#L249
caplogstuff working. But I read all about
caplogand there's no reason it shouldn't work. So I tried just straight raising an exception in the skill, and finally just tried putting a breakpoint (like a
pdb.set_trace()) in the skill... and none of it registered. There didn't seem to be any change I could make in the skill that would affect anything at all. I tried this with multiple skills. I only tried this with skills in the github connector so far.
assert resp.status == 201which waits for the skill to be called. Maybe even adding an
asyncio.sleepafter will be enough to get it to hit your breakpoint. But we probably need some testing utility which blocks until the skill has been called.
I have a question about the Github connector. I'm trying to make some modifications to it just to test some stuff out. I make my modifications and run opsdroid with a Github skill set up for the PRClosed event.
I close a PR in my repo which runs the skill. I can tell the skill is initially triggered because I see this message in my opsdroid log:
2021-08-22 23:41:33,955 INFO aiohttp.access: 127.0.0.1 [23/Aug/2021:04:41:33 +0000] "POST /connector/github HTTP/1.1" 201 191 "-" "GitHub-Hookshot/59a1e9d". That implies to me that this line was executed: https://github.com/opsdroid/opsdroid/blob/master/opsdroid/connector/github/__init__.py#L346
However, the code in my skill itself is never run. My guess is that due to the changes I made, there is an error somewhere up the chain in opsdroid itself before my actual skill is run. Something is failing, but there appears to be some sort of rescue in place so that the entire opsdroid itself doesn't die. If that's the case, there is no message being logged, so I can't tell where control goes after the line I pasted above.
Can anyone tell me if they think I'm even on the right path?