-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Already imported module #2992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
there is certain places at which things can be availiable, without knowing your code its not clear how oyu use things together |
Okay, then. Here is part of my code: #!/usr/bin/env python2.7
import pytest, requests
from ..coordinator.rtc_master import RtcMaster
IP = '127.0.0.1'
EXTENSION = '/rtc'
class TestRtcMaster(object):
# See https://docs.pytest.org/en/latest/fixture.html to learn about fixtures
@pytest.fixture(scope='class', autouse=True)
# NOTE: setting the scope to class lets us only create the rtc master once and pass that around to
# all of the functions
def rtc_master(self):
""" Fixture for creating a Rtc Master """
assert requests.get('https://' + IP + '/rtc/info', verify=False, timeout=2).status_code == 200
return RtcMaster('127.0.0.1', '/rtc')
def test_init(self, rtc_master):
""" Check if RtcMaster was created """
assert rtc_master
assert isinstance(rtc_master, RtcMaster)
@pytest.inlineCallbacks
def test_list_streams(self, rtc_master):
""" Check if RtcMaster was created """
stream_list = yield rtc_master.list_rtc_streams()
assert isinstance(stream_list, list) |
@keller00 how's your environment? You should not have to use |
@nicoddemus I'm not using a virtual environment. It is detected automatically as you can see here:
|
Are you passing [pytest]
twisted=1 Adding |
Okay, I that fixes the problem. Thank you! |
It is active, but for some reason the callbacks are only available if explicitly sets that "twisted" flag... not sure why pytest-twisted authors decided to do that: https://github.com/pytest-dev/pytest-twisted/blob/master/pytest_twisted/__init__.py#L19 |
Okay, thanks! I'll bug them with my question. |
Hey!
I'm trying to migrate over my tests from nose to pytest to test my twisted application.
This site says:
If a plugin is installed, pytest automatically finds and integrates it, there is no need to activate it.
So according to this all I have to do is pip install pytest-twisted, but when I try running my tests I get:
AttributeError: 'module' object has no attribute 'inlineCallbacks'
So on this site it says to put the following into conftest.py:
pytest_plugins = "pytest_twisted"
So I make
conftest.py
next to my testing Python file in the tests folder and get the following warning:It seems like it auto discovers the plugin, but doesn't update itself with inlinecallback without reimporting it? Would this be a bug, or just me not understanding something properly?
Any help is appreciated! Thank you!
The text was updated successfully, but these errors were encountered: