-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
MNT: Update doc about setup.py and py.test #10756
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a few comments.
astropy/tests/runner.py
Outdated
@@ -334,7 +334,7 @@ def coverage(self, coverage, kwargs): | |||
warnings.warn( | |||
"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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we don't allow setup.py test
anymore. I am confused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I think this should be pytest --cov
here not --coverage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@saimn made me undo the changes, so --cov
doesn't apply no more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not deprecated, it outright won't work anymore as far as this package is concerned.
Line 13 in 7962503
Note: running tests is no longer done using 'python setup.py test'. Instead |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test command is still used by downstream packages that use astropy helpers
astropy/tests/runner.py
Outdated
@@ -378,7 +378,7 @@ def test_path(self, test_path, kwargs): | |||
|
|||
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
@@ -124,7 +127,7 @@ by ``CHANGES.md`` in the instructions. | |||
all pass, you can proceed on. | |||
|
|||
#. 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Until python-build
is shipped officially everywhere, we cannot recommend it yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree we should mention python-build here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff: spacetelescope/acstools@f556c6f
Am I using it wrong? I tried to follow the Python doc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow so much outdated stuff, thanks for catching it all! A few comments below.
astropy/tests/command.py
Outdated
``./setup.py test`` distutils command. | ||
""" | ||
|
||
"""Implements the wrapper for the Astropy test runner.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
@@ -57,6 +57,9 @@ by ``CHANGES.md`` in the instructions. | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about linking to the 4.0 docs for projects that don't have this file?
@@ -124,7 +127,7 @@ by ``CHANGES.md`` in the instructions. | |||
all pass, you can proceed on. | |||
|
|||
#. 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree we should mention python-build here
# | ||
# Check setup by running tests | ||
# | ||
cd astropy/coordinates/tests # get ready to run coordinate tests | ||
py.test # test | ||
pytest # test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
ls # what is here? | ||
# | ||
# Write a test in test_arrays.py to expose this bug | ||
# | ||
# 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pytest astropy/coordinates/tests/test_arrays
- etc for the rest of the instructions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks @pllim 👍
I will leave the final approval to @astrofrog.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
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.py
andpy.test
usage.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.test
in #10722, which seemed to have missed the files I edited here.