Closed pllim closed 6 years ago
I also see this in the pytest
warnings. Now I am just very confused.
Module already imported so cannot be rewritten: pytest_remotedata
I am thinking this is a real bug and it is biting me because there is a failed test that is not caught in https://travis-ci.org/astropy/astropy/jobs/382189395#L4542 , a Travis job for Python 2 that is testing --remote-data=astropy
.
And looks like it is still happening in master
as well, not just v2.0.x
.
This is using --remote-data=astropy
:
https://travis-ci.org/astropy/astropy/jobs/382829806#L5025
astropy/utils/tests/test_data.py sssssss...........s.....s.s.. [ 93%]
This is using just --remote-data
:
https://travis-ci.org/astropy/astropy/jobs/382829810#L5028
astropy/utils/tests/test_data.py ............................. [ 93%]
Maybe it is because of this logic:
elif remote_data_config == 'astropy':
if source == 'any':
pytest.skip("need --remote-data option to run")
When --remote-data=astropy
is given, remote_data_config == 'astropy'
is True
and source == 'any'
is also True
by default. I can't say I understand the basis of that logic block.
Just to record for posterity: the problem here is actually that the tests in question do not use the source=
kwarg when passing the source argument to the remote_data
decorator. On the one hand, we can support this alternative calling scheme (which is what #27 provides). On the other hand, we could just make Astropy fix these "degenerate" cases.
I am testing something in Astropy v2.0.x branch in Python 2 environment and I noticed that
--remote-data=astropy
and--remote-data=none
skip the same tests even when I know there are some tests marked as@remote_data('astropy')
in the test file. I was expecting that--remote-data=astropy
would skip less tests (i.e., run more tests).But when I run with
--remote-data
(any), they are not skipped anymore.Here is an example test function in the given test file: