errbotio / errbot

Errbot is a chatbot, a daemon that connects to your favorite chat service and bring your tools and some fun into the conversation.
http://errbot.io
GNU General Public License v3.0
3.13k stars 615 forks source link

How to make TestBot use text backend? (6.1) #1412

Closed nicoddemus closed 10 months ago

nicoddemus commented 4 years ago

In order to let us help you better, please fill out the following fields as best you can:

I am...

I am running...

Issue description

I use the testbot fixture to run my tests. Since upgrade err-bot from 5.2 to 6.1.2, I see this error when executing the tests in my environment:

Traceback (most recent call last):
  File ".env36\Lib\site-packages\errbot\backends\graphic.py", line 18, in <module>
    from PySide import QtCore, QtGui, QtWebKit
ModuleNotFoundError: No module named 'PySide'
2020-01-30 09:33:24,857 CRITICAL errbot.plugins.graphic     To install graphic support use:
    pip install errbot[graphic]

It seems the default for backends has changed to "graphic". If I install errbot-5.2 then my tests pass as expected.

My question is: how do I change the backend of testbot to text?

Also, shouldn't the backend for testbot be text by default?

sijis commented 4 years ago

What is the command or setup you use to start the plugin tests?

rcoup commented 4 years ago

I'm hitting the same issue:

tox.ini:

[tox]
envlist = py38
skipsdist = True

[testenv]
commands = py.test {posargs}
deps =
    mock
    pytest
    pytest-pep8
    -r{toxinidir}/requirements.txt

[pytest]
norecursedirs = .* data helm venv errbot

Running tox fails, so does pytest mybot/test_tz.py

mybot/test_tz.py:

from . import tz

pytest_plugins = ["errbot.backends.test"]
extra_plugin_dir = '.'

def test_time(testbot):
    testbot.push_message('!time')
    assert 'This is my awesome command' in testbot.pop_message()

Full log output from pytest -v -x mybot/test_tz.py is at https://gist.github.com/rcoup/4d66f9fd4da401e0604673ac18a01340

come-maiz commented 4 years ago

this happens to me because I have my myplugin.plug and myplugin.py files in the same place where I have my .venv. In the tests directory I have a test that does;

test.TestBot(extra_plugin_dir=os.path.join(os.path.dirname(__file__), '..'))

Then, TestBot does a glob to find all the files with .plug, finding myplugin, but also all the plugins installed in the .venv with errbot.

It would be more useful if I can tell TestBot to load only my plugin, by name.

kennedy commented 3 years ago

bump.

PySides has been removed in https://github.com/errbotio/errbot/pull/1495

sijis commented 10 months ago

Seems no longer relevant.