Repository navigation
MNT: Update doc about setup.py and py.test - #10756
Conversation
saimn
left a comment
There was a problem hiding this comment.
Looks good, just a few comments.
| "The coverage option is ignored on run_tests, since it " | ||
| "can not be made to work in that context. Use " | ||
| "'python setup.py test --coverage' instead.", | ||
| "'pytest --coverage' instead.", |
There was a problem hiding this comment.
--coverage is an option specific to setup.py test, and since this is a warning specific to the test runner it should not be changed ?
There was a problem hiding this comment.
But we don't allow setup.py test anymore. I am confused.
There was a problem hiding this comment.
yeah I think this should be pytest --cov here not --coverage
There was a problem hiding this comment.
@saimn made me undo the changes, so --cov doesn't apply no more.
There was a problem hiding this comment.
This warning is emitted when you run setup.py test, so it seems weird that it then refers to pytest instead.
And I'm not sure if setup.py test is actually deprecated ?
There was a problem hiding this comment.
It is not deprecated, it outright won't work anymore as far as this package is concerned.
Line 13 in 7962503
There was a problem hiding this comment.
The test command is still used by downstream packages that use astropy helpers
| if ext in ('.rst', ''): | ||
| if kwargs['docs_path'] is None: | ||
| # This shouldn't happen from "python setup.py test" | ||
| # This shouldn't happen from "pytest" |
|
|
||
| #. If you did the previous step, do ``git clean -fxd`` again to remove anything | ||
| you made there. Run ``python setup.py build sdist --format=gztar`` to | ||
| you made there. Run ``python -m pep517.build --source .`` to |
There was a problem hiding this comment.
This will need to be replaced by python-build in the short term (https://python-build.readthedocs.io/en/latest/). I'm not sure exactly what's the status of this, but pep517.build is going to be replaced by python-build soon.
There was a problem hiding this comment.
Until python-build is shipped officially everywhere, we cannot recommend it yet.
There was a problem hiding this comment.
Yes, there's a bit of urgency to make pep517.build disappear, see discussion pypa/pyproject-hooks#83
If this bit of documentation is going to stick around in a stable version for some months, I'd say it's risky
There was a problem hiding this comment.
You can install python-build already, so I don't think there is an issue with recommending it now.
There was a problem hiding this comment.
Agree we should mention python-build here
There was a problem hiding this comment.
But why? Isn't it too soon? I tried using it in one of my packages and it doesn't work.
There was a problem hiding this comment.
all python build is, is a CLI for pep517 it should work fine. What trouble did you run into?
There was a problem hiding this comment.
The diff: spacetelescope/acstools@f556c6f
Am I using it wrong? I tried to follow the Python doc.
There was a problem hiding this comment.
You didn't install the build package 😉 Also, have you considered using https://github.com/OpenAstronomy/azure-pipelines-templates I hear some really awesome people maintain it 😛
There was a problem hiding this comment.
Huh... You would think Python would install it automatically since it is like so essential. Thanks! I'll try that.
Re: Azure -- I would have just switched to Actions. I just don't have time to refactor the CI for that package. 😬
|
@saimn , I think I have addressed your comments. How does it look now? |
astrofrog
left a comment
There was a problem hiding this comment.
Wow so much outdated stuff, thanks for catching it all! A few comments below.
| ``./setup.py test`` distutils command. | ||
| """ | ||
|
|
||
| """Implements the wrapper for the Astropy test runner.""" |
There was a problem hiding this comment.
Maybe add a note that this is just here for backward-compatibility for other packages and can be removed once astropy-helpers is no longer supported?
| python -m pep517.build --source . | ||
|
|
||
| All following instructions will assume you have ``pyproject.toml``, so | ||
| please adjust accordingly if that is not the case yet. |
There was a problem hiding this comment.
What about linking to the 4.0 docs for projects that don't have this file?
|
|
||
| #. If you did the previous step, do ``git clean -fxd`` again to remove anything | ||
| you made there. Run ``python setup.py build sdist --format=gztar`` to | ||
| you made there. Run ``python -m pep517.build --source .`` to |
There was a problem hiding this comment.
Agree we should mention python-build here
| # | ||
| cd astropy/coordinates/tests # get ready to run coordinate tests | ||
| py.test # test | ||
| pytest # test |
There was a problem hiding this comment.
Instead of these two lines, pytest astropy/coordinates would be better because it will load the pytest config in setup.cfg and will also run doctests not in the tests directory.
| # After edit, re-test | ||
| # | ||
| py.test test_arrays.py # Hopefully this succeeds | ||
| pytest test_arrays.py # Hopefully this succeeds |
There was a problem hiding this comment.
pytest astropy/coordinates/tests/test_arrays - etc for the rest of the instructions
There was a problem hiding this comment.
I think updating the actual instruction is out of scope here. The whole thing is way outdated. The log shows Python 2, etc etc. Maybe @mwcraig can update it when he has time. I am not even sure where this info is displayed. I just modify it for consistency in regards to "py.test" since grep found it.
There was a problem hiding this comment.
I had completely forgotten about this. It probably needs to be re-written from the ground up if we want it to stay around. I agree this is outside the scope of this PR.
There was a problem hiding this comment.
Okay, we can follow-up over at #10777 . Thanks!
| @@ -305,7 +303,7 @@ accuracy/test_icrs_fk5.py . | |||
|
|
|||
| # So far, so good, now check ALL tests | |||
| $ cd ../../.. # up to the top level to check all of the tests | |||
There was a problem hiding this comment.
Again we should basically always run pytest from the root of the repo
|
I have applied the comments except the following:
|
|
Okay, what about now? |
saimn
left a comment
There was a problem hiding this comment.
Looks good to me, thanks @pllim 👍
I will leave the final approval to @astrofrog.
MNT: Update doc about setup.py and py.test
MNT: Update doc about setup.py and py.test
|
This has been already released, but milestone hasn't been updated accordingly, fixing it now. |
Description
This pull request is to address mentions of outdated
setup.pyandpy.testusage.I am still not so sure about milestoning doc changes. I am guessing this should go in bug fix for 4.1? If not, feel free to re-milestone.
Close #10752
p.s. There was also a previous effort to replace
py.testin #10722, which seemed to have missed the files I edited here.