Repository navigation
Conversation
This comment has been minimized.
This comment has been minimized.
|
@pllim - tox works in conda, what error do you get ? |
This comment has been minimized.
This comment has been minimized.
|
Huh... I try the |
This comment has been minimized.
This comment has been minimized.
pllim
left a comment
There was a problem hiding this comment.
Need to know how to deactivate tox env.
| development and then use direct ``pytest`` commands within that environment. | ||
| For instance:: | ||
|
|
||
| tox -e test-alldeps --develop --notest |
There was a problem hiding this comment.
Is this really something that we should be recommending? It seems like a very weird way to spin up a virtualenv and people might end up here in all manner of weird ways and not really understand what they are doing, (i.e. virtualenv inside conda etc).
The justification from the sentence below is:
Now, one can run any of the
pytestcommands below to only run tests that are relevant to the development one is doing.
You can already customise the pytest behaviour by passing extra args to the tox command, and you can skip the (slow) sdist creation and build with the --develop flag. I really think this should at least come with a large health warning on the top. I see the utility if you really have to debug a failure in one specific tox env and you really want to get in there with a python interpreter, but I really struggle to see the justification for doing this to run anything but the most spectacularly complex pytest commands.
There was a problem hiding this comment.
@Cadair - this came from real life problems from experienced developers (@mhvk and myself) having trouble just being able to run tests in an agile manner. What we need is a way to be able to have a one-time setup that reproduces accurately the travis test environment and then be able to re-run tests (over and over again, sometimes) in a few seconds, ala:
pytest astropy/time --pdb -k test_darn_its_still_failing
In discussions referenced in #10303, this was the best we came up with. If you have a better suggestion, please do tell!! That would be great. You can see already below that I also am not quite happy with the conda/virtualenv mixture that is likely coming out of this.
There was a problem hiding this comment.
And note there are still outstanding problems with pytest as far as I can tell. If I just blindly install pytest, that gives me 5.4.0 and the dreaded error in test collection:
E pytest.PytestDeprecationWarning: direct construction of DocTestModulePlus has been deprecated, please use DocTestModulePlus.from_parent
Maybe I'm doing something wrong, but if I am having problems that means others may be in the same boat.
The point being that pinning certain packages (which happens in the tox setup) can be important.
There was a problem hiding this comment.
@taldcroft - what version of pytest-doctestplus are you using? The issues should be fixed with v0.7.0
There was a problem hiding this comment.
I was using 0.5. On conda (astropy / conda-forge) the latest available seems to be 0.6.1.
There was a problem hiding this comment.
@Cadair - yes, if there is a good way just with tox, that would be preferable! The one advantage of the present suggestion is that it shows, indirectly, a bit how tox actually works.
There was a problem hiding this comment.
The suggested workaround on the tox issue is to put the build deps from pyproject.toml into the deps= list in tox.ini which does seem to work, although isn't an ideal solution imo.
There was a problem hiding this comment.
There is a tox rewrite underway, I just asked upstream if the bug will be properly addressed in the new version 🤞🏽
There was a problem hiding this comment.
@Cadair, @astrojuanlu - this PR got stuck because my recommendation for fast testing with tox --develop --no-test and then enabling the virtual environment was clearly not ideal, but on the other hand there didn't seem to be a good alternative. I see that @Cadair's tox issue tox-dev/tox#1595 has been closed because this is fixed in "the rewrite branch", though I think that implies tox 4, which is not out yet. It certainly still fails with ~current tox.
Since it now has been more than a year with no other effective solution, my sense is to get this PR in and revisit when there is a better solution. But I'm also happy to just let it auto-close - after all, my own work flow is now fine...
There was a problem hiding this comment.
My feeling is that tox 4 is "almost there", but that can still mean a few months. This is a net improvement on the current docs, so I'm 👍🏽 on getting it in.
|
|
||
| Now, one can run any of the ``pytest`` commands below to only run tests that | ||
| are relevant to the development one is doing. If the development includes | ||
| documentation, one could install the documentation dependencies in the same |
There was a problem hiding this comment.
There is one catch, if I have things right, namely the graphviz dependency which must come either via conda or via a separate system-wide install. So for this pip-centric workflow you cannot imply all the docs dependencies are part of the "environment".
Now on Mac, doing a system install of graphviz requires either homebrew or macports. I don't use either of those. So then for me that means making a base environment with conda and then a tox-generated virtualenv under that. This leads me to have a command line prompt like (base) (test-alldeps) which is a bit unseemly to me.
So despite having agreed the tox-virtualenv might be a good way forward, I have stopped using it in favor of just making a conda environment that has the right deps using #10343.
There was a problem hiding this comment.
I have removed the documentation part, as this could just make things harder than easier.
| --------------------------------------------- | ||
|
|
||
| As noted, running ``tox`` can be quite slow, yet it has the advantage over the | ||
| other methods that it puts together a consistent set of dependencies. One can |
There was a problem hiding this comment.
07f5dd9 to
cf422d6
Compare
|
I updated this small PR to describe how to do development within a tox environment, since my sense would be that it is better to have something reasonable rather than nothing. But fine also to close or postpone. |
|
Could a tox enthusiast say a final say on this? maybe @Cadair? |
|
tox4 should fix that (tox-dev/tox#1945) so maybe we wait a little more ? |
cf422d6 to
a7ce964
Compare
|
Hi humans 👋 - this pull request hasn't had any new commits for approximately 10 hours. I plan to close this in 30 days if the pull request doesn't have any new commits by then. In lieu of a stalled pull request, please consider closing this and open an issue instead if a reminder is needed to revisit in the future. Maintainers may also choose to add keep-open label to keep this PR open but it is discouraged unless absolutely necessary. If this PR still needs to be reviewed, as an author, you can rebase it to reset the clock. If you believe I commented on this pull request incorrectly, please report this here. |
LoL... looks like bot still a little buggy. I'll investigate. 😬 Update: Hopefully I fixed the bug. Sorry about that! |
|
Hi humans 👋 - this pull request hasn't had any new commits for approximately 4 months. I plan to close this in 30 days if the pull request doesn't have any new commits by then. In lieu of a stalled pull request, please consider closing this and open an issue instead if a reminder is needed to revisit in the future. Maintainers may also choose to add keep-open label to keep this PR open but it is discouraged unless absolutely necessary. If this PR still needs to be reviewed, as an author, you can rebase it to reset the clock. If you believe I commented on this pull request incorrectly, please report this here. |
|
tox4 will release a beta soonish tox-dev/tox#2298 I'm already using the latest alpha for all my projects and it does solve a number of issues. Maybe this can hold off a couple if months? |
|
Sure, I removed the |
|
Yes, absolutely fine to wait a bit longer - would be nice to have a more elegant solution! |
|
Hi humans 👋 - this pull request hasn't had any new commits for approximately 5 months. I plan to close this in 30 days if the pull request doesn't have any new commits by then. In lieu of a stalled pull request, please consider closing this and open an issue instead if a reminder is needed to revisit in the future. Maintainers may also choose to add keep-open label to keep this PR open but it is discouraged unless absolutely necessary. If this PR still needs to be reviewed, as an author, you can rebase it to reset the clock. If you believe I commented on this pull request incorrectly, please report this here. |
|
I'm going to close this pull request as per my previous message. If you think what is being added/fixed here is still important, please remember to open an issue to keep track of it. Thanks! If this is the first time I am commenting on this issue, or if you believe I closed this issue incorrectly, please report this here. |
|
I needed this documentation today, too bad it is only available in a closed PR... Use case - tricky test failure that only shows up for numpy 1.18 ( |
Am I doing something wrong? |
|
The bot will mark this as stale again unless you rebase, FYI. |
No, this is the bug that caused this PR to stall out. Tox doesn't support doing this with build deps. tox-dev/tox#1595 I am happy to put the sequence of commands in this diff in the documentation, but I think the surrounding justification is misleading. We should be recommending people do this is the case where they really need an environment controlled by tox to debug an issue with CI etc, and link to the tox bug / explain why you can't do On a related note, the infrastructure team should probably start porting our plugins to tox 4... |
|
@Cadair - ah, thanks for the explanation. So maybe following the transition to tox4 we can revisit this... |
|
Tox 4 has been released today (and broke all our CI), when we have adapted our config for tox 4 etc we should be able to revisit this. |
As promised in #10303, once we found out how to easily set up an environment for testing, I would add it to the documentation. This is meant to do that. In the process, I also saw an annoying note about
py.testinstead ofpytestso I went through an removed all out-of-date references.I'm not 100% sure about whether there shouldn't be references to this elsewhere...
fixes #10303