errbot icon indicating copy to clipboard operation
errbot copied to clipboard

How to make TestBot use text backend? (6.1)

Open nicoddemus opened this issue 5 years ago • 4 comments

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

I am...

  • [ ] Reporting a bug
  • [ ] Suggesting a new feature
  • [ ] Requesting help with running my bot
  • [X] Requesting help writing plugins
  • [ ] Here about something else

I am running...

  • Errbot version: 6.1.2
  • OS version: Windows
  • Python version: 3.6.8
  • Using a virtual environment: yes

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?

nicoddemus avatar Jan 30 '20 12:01 nicoddemus

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

sijis avatar Jan 30 '20 23:01 sijis

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

rcoup avatar Aug 19 '20 15:08 rcoup

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.

come-maiz avatar Aug 25 '20 04:08 come-maiz

bump.

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

kennedy avatar Apr 09 '21 13:04 kennedy

Seems no longer relevant.

sijis avatar Jan 05 '24 17:01 sijis