You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running tests with tox is much more powerful, but requires a bit more setup.
299
-
300
-
You'll need to export an environment variable for *each* tox environment you wish to test with. For example, if you want to test with `Python 3.9` and
301
-
`Python 3.6`, but only care to check the `core` specs, you would need to ensure that the following variables are exported:
302
-
303
-
```
304
-
export PLOTLY_TOX_PYTHON_39=<python binary>
305
-
export PLOTLY_TOX_PYTHON_36=<python binary>
306
-
```
307
-
308
-
Where the `<python binary` is going to be specific to your development setup. As a more complete example, you might have this loaded in a `.bash_profile` (or equivalent shell loader):
309
-
310
-
```bash
311
-
############
312
-
# tox envs #
313
-
############
314
-
315
-
export PLOTLY_TOX_PYTHON_39=python3.9
316
-
export PLOTLY_TOX_PYTHON_36=python3.6
317
-
export TOXENV=py39-core,py36-core
318
-
```
319
-
320
-
Where `TOXENV` is the environment list you want to use when invoking `tox` from the command line. Note that the `PLOTLY_TOX_*` pattern is used to pass in variables for use in the `tox.ini` file. Though this is a little setup, intensive, you'll get the following benefits:
321
-
322
-
*`tox` will automatically manage a virtual env for each environment you want to test in.
323
-
* You only have to run `tox` and know that the module is working in all included Python versions.
324
-
325
-
Finally, `tox` allows you to pass in additional command line arguments that are formatted in (by us) in the `tox.ini` file, see `{posargs}`. This is setup to help with our configuration of [pytest markers](http://doc.pytest.org/en/latest/example/markers.html), which are set up in `pytest.ini`. To run only tests that are *not* tagged with `nodev`, you could use the following command:
326
-
327
-
```bash
328
-
tox -- -a '!nodev'
329
-
```
330
-
331
-
Note that anything after `--` is substituted in for `{posargs}` in the tox.ini. For completeness, because it's reasonably confusing, if you want to force a match for *multiple*`pytest` marker tags, you comma-separate the tags like so:
332
-
333
-
```bash
334
-
tox -- -a '!nodev','!matplotlib'
335
-
```
336
-
337
293
### Writing Tests
338
294
339
295
You're *strongly* encouraged to write tests that check your added functionality.
340
296
341
297
When you write a new test anywhere under the `tests` directory, if your PR gets accepted, that test will run in a virtual machine to ensure that future changes don't break your contributions!
342
-
343
-
Test accounts include: `PythonTest`, `PlotlyImageTest`, and `PlotlyStageTest`.
0 commit comments