How to configure properly unit testing with Errbot?

175 Views Asked by At

I tried to follow this guide http://errbot.io/en/latest/user_guide/plugin_development/testing.html

I installed pytest and launch it with

pytest --rootdir='./srv/plugins'

but I have this following error:

Traceback (most recent call last):
  File "./errbot/app/venv/lib/python3.4/site-packages/errbot/backends/graphic.py", line 19, in <module>
    from PySide import QtCore, QtGui, QtWebKit
ImportError: No module named 'PySide'
2018-06-11 16:30:44,930 CRITICAL errbot.backends.graphic    To install graphic support use:
    pip install errbot[graphic]

It looks like pytest tries to run Errbot in graphical mode whereas I am using Errbot with a text backend just fine.

As the plugins might need at some point to use the configuration file given to Errbot, I wonder how to do the same while using pytest...

I reproduce on the host the arboresence found on a Docker image

errbot
    app
        venv
        config.py
        requirements.txt
    srv
        data
        errbackends
        plugins
            Samples
                samples.plug
                samples.py
    run.sh

Then, I run errbot with a my backend - in my case Mattermost - like this:

./run.sh -c ./app/config.py

And for the text as backend

./run.sh -c ./app/config.py --text

In run.sh, I inject some environment variables and activate venv before calling errbot.

Actually, I could reproduce my issue on the unit testing by launching errbot in graphical mode

./run.sh -c ./app/config.py --graphic

Therefore, I wonder how to inject the right config for the unit tests as I can do while running errbot.

0

There are 0 best solutions below