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
Plugin does not loaded #9
Comments
platform linux2 -- Python 2.7.3 -- py-1.4.26 -- pytest-2.6.4 -- /usr/bin/python
plugins: xdist
collected 2 items / 2 errors pip list | grep pytest
pytest (2.6.4)
pytest-flask (0.3.4)
pytest-xdist (1.9) |
|
yes. all packages are installed via pip. |
I can't reproduce your environment, can you run a simplest example (something like in #7 (comment))? |
platform darwin -- Python 2.7.8 -- py-1.4.26 -- pytest-2.6.4
plugins: flask, xdist
collected 1 items
test_app.py .
=== 1 passed in 0.02 seconds ===
vital@macbook .../tmp-1fdb6130449b8aa2 workon tmp-1fdb6130449b8aa2
$ pip list | grep pytest
pytest (2.6.4)
pytest-flask (0.3.4)
pytest-xdist (1.11) |
I did following import pytest
def create_app():
from flask import Flask, jsonify
app = Flask(__name__)
@app.route('/ping')
def ping():
return jsonify(ping='pong')
return app
@pytest.fixture
def app():
app = create_app()
app.debug = True
return app
class TestApp:
def test_ping(self, client):
res = client.get(url_for('ping'))
assert res.status_code == 200
assert res.json == {'ping': 'pong'}
if __name__ == '__main__':
app = create_app()
app.run(port=5000) the output
pytest plugin is not loaded. |
So, i upgraded my vagrant box to ubuntu 14.04 and python 2.7.6 and it works. Probably older python 2.7.3 was causing the issue. Thanks for the fast replies! |
👍 happy testing. |
Here's a possibly relevant anecdote: I was getting exactly the |
Thanks @evadeflow for a note. But this looks a little bit strange for me. Do you update your python/pytest environment at first, as mentioned before? |
add the required fixture
|
@kabapy if i do so, then i'll get an error telling me url_for needs to be ran with a context-manager. i have the same issue of not being able to find client fixture. |
i was able to pass the test's by removing pytest, pytest-flask and installing them again. |
I avoid flask-pytest and use pytest directly |
Re #7 (comment)
Looks like a
pytest-flask
not loaded at all:available fixtures: pytestconfig, app, recwarn, monkeypatch, capfd, capsys, tmpdir
Can you provide a head of your
pytest
stack trace? The list of loadedplugins shows at the top, for example:
$ py.test tests/ test session starts platform darwin -- Python 2.7.8 -- py-1.4.24 -- pytest-2.6.2 plugins: flask collected 443 items ...
/cc @bonya
The text was updated successfully, but these errors were encountered: