-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Can't run tests with py.test #4878
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
You need to add src to the Python path: |
And yes the documentation should be updated :P. |
Command helps, but tests fail - https://pastebin.mozilla.org/9073260 - which is strange, considering that builds are green. |
I think the tests ran invoked the system pip. ( I, for one, use the tox environment itself -- with |
Also, to pass arguments to pytest through tox, you can run tests as |
|
One of them seems to be because SVN isn't installed. The other seems to be a more esoteric error. One of them is an expected failure. |
@techtonik Anything actionable here? |
(note: the documentation has been updated to say install everything in |
Closing due to lack of activity. |
@pradyunsg actionable - open https://pip.pypa.io/en/stable/development/#running-tests and run tests with all ways to confirm it is broken for you too. |
i believe all thats needed is a note to run the test against the installed pip ^^ |
So... I took too much time to come around to this. Thanks for filing this @techtonik! I think we should just remove all the non-tox ways to running tests. I don't think any of the pip maintainers use those (which is why they've broken over time) and having one way to run tests is easier to understand, maintain, and help contributors with. #5526 does this and (a lot) more. Would appreciate feedback on that PR. :) |
+1 on this, but just to be clear, the docs should describe the "normal", or "recommended" workflow. That's not to say that we don't allow people to (say) run |
Agreed. That's exactly what I've done in #5526. |
Does |
Yeah. It does. It's setup such that it forwards arguments to pytest, so you can do |
Also, nobody's stopping you running pytest by hand. We're just saying that tox sets everything up cleanly and lets you run whatever pytest invocation you want. But if you prefer to run pytest manually, that's fine - it's just up to you to make sure you do things like setting By making tox the documented option, we avoid having to turn the pip docs into a pytest tutorial. |
And how much time it takes to run a single test with
Except that it doesn't run #4878. |
Yes, pytest doesn't work out of the box. This is a consequence of the fact that the project is structured with an src directory to explicitly push devs to test against the installed version of pip when they run the tests. You need to install the development version of pip before actually running the tests. One way to do it: $ pip install -e .
$ # hack, hack, hack
$ pytest
It does take slightly more time, since tox checks the environment and then installs the development version of pip. On my machine, after setting up the venv on the first run, this takes under half a second. But if even that's an issue then after tox sets up an environment the first time, you can just call the pytest in that environment:
This is the same (functionally) as doing:
This works because pip's installed via And, you've linked to the same issue. And we're switching away from suggesting that
+ in this comment I've told you how to use pytest if you really want to. This isn't something I encourage; heck I'd say that don't do this unless you understand that this may cause other issues like a typo can cause your development virtual environment to break and they're something you want to deal with. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Documented way of running tests with just
py.test
doesn't work.tox
runs fine though.The text was updated successfully, but these errors were encountered: