astropy / package-template

Template for packages that use Astropy. Maintainer: @astrofrog
http://docs.astropy.org/projects/package-template/en/latest/
Other
60 stars 63 forks source link

Passing remote-data flag through tox? #471

Closed bmorris3 closed 4 years ago

bmorris3 commented 4 years ago

Hi team!

I'm working with the package template on a package that has fetches some remote data within its tests. I think the way to flag this in the tox infrastructure is to add the flag:

[tool:pytest]
addopts =
    --remote-data

Is that correct, or is there a better way to do it? Perhaps we can add this line to the package template and comment it out, so it's easy to discover for other users?

Cadair commented 4 years ago

By default you can pass extra arguments to pytest by doing tox -e ... -- --remote-data.

If you want to have a specific environment which runs the online tests (i.e. tox -epy38-online) you can customise thecommands=` line in tox.ini, you can look at sunpy's tox.ini file to see an example of doing this.

astrofrog commented 4 years ago

Also see the core package's Travis configuration to see how to add the flag during CI to only some builds.

bmorris3 commented 4 years ago

@Cadair – Ah thanks! When I tried tox -e test --remote-data I get:

tox -e test --remote-data
tox: error: unrecognized arguments: --remote-data

I see that I needed the extra -- to make it work.

Thanks also to @astrofrog for the syntax example!