Skip to content

Commit dee2f7f

Browse files
committed
updated contributing notes and chart-studio tox.ini
1 parent f2b60d8 commit dee2f7f

File tree

4 files changed

+21
-24
lines changed

4 files changed

+21
-24
lines changed

contributing.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contributing
22

3-
The bottom line. Follow your Nose, or our Nose. Write-run-love tests :fist:.
3+
Thank you for contributing to plotly.py!
44

55
## Code of Conduct
66

@@ -128,34 +128,34 @@ classes based on the new schema.
128128
We take advantage of two tools to run tests:
129129

130130
* [`tox`](https://tox.readthedocs.io/en/latest/), which is both a virtualenv management and test tool.
131-
* [`nose`](https://nose.readthedocs.org/en/latest/), which is is an extension of Python's unittest
131+
* [`pytest`](https://docs.pytest.org/en/latest/), a powerful framework for unit testing.
132132

133-
### Running Tests with `nose`
133+
### Running Tests with `pytest`
134134

135135
Since our tests cover *all* the functionality, to prevent tons of errors from showing up and having to parse through a messy output, you'll need to install `optional-requirements.txt` as explained above.
136136

137-
After you've done that, go ahead and follow (y)our Nose!
137+
After you've done that, go ahead and run the test suite!
138138

139139
```bash
140-
nosetests -w packages/python/plotly/plotly/tests/
140+
pytest packages/python/plotly/plotly/tests/
141141
```
142142

143143
Or for more *verbose* output:
144144

145145
```bash
146-
nosetests -w packages/python/plotly/plotly/tests/ -v
146+
pytest -v packages/python/plotly/plotly/tests/
147147
```
148148

149149
Either of those will run *every* test we've written for the Python API. You can get more granular by running something like:
150150

151151
```bash
152-
nosetests -w packages/python/plotly/plotly/tests/test_core/
152+
pytest packages/python/plotly/plotly/tests/test_core/
153153
```
154154

155155
... or even more granular by running something like:
156156

157157
```bash
158-
nosetests plotly/tests/test_plotly/test_plot.py
158+
pytest plotly/tests/test_plotly/test_plot.py
159159
```
160160

161161
### Running tests with `tox`
@@ -187,16 +187,16 @@ Where `TOXENV` is the environment list you want to use when invoking `tox` from
187187
* `tox` will automatically manage a virtual env for each environment you want to test in.
188188
* You only have to run `tox` and know that the module is working in both `Python 2` and `Python 3`.
189189

190-
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 `nose attr` configuration. To run only tests that are *not* tagged with `slow`, you could use the following command:
190+
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 `packages/python/plotly/pytest.ini`. To run only tests that are *not* tagged with `nodev`, you could use the following command:
191191

192192
```bash
193-
tox -- -a '!slow'
193+
tox -- -a '!nodev'
194194
```
195195

196-
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* `nose attr` tags, you comma-separate the tags like so:
196+
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:
197197

198198
```bash
199-
tox -- -a '!slow','!matplotlib'
199+
tox -- -a '!nodev','!matplotlib'
200200
```
201201

202202
### Writing Tests

packages/python/chart-studio/tox.ini

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@
2424
; PASSING ADDITONAL ARGUMENTS TO TEST COMMANDS
2525
; The {posargs} is tox-specific and passes in any command line args after `--`.
2626
; For example, given the testing command in *this* file:
27-
; nosetests {posargs} -x plotly/tests/test_core
27+
; pytest {posargs} -x plotly/tests/test_core
2828
;
2929
; The following command:
30-
; tox -- -a '!slow'
30+
; tox -- -k 'not nodev'
3131
;
3232
; Tells tox to call:
33-
; nosetests -a '!slow' -x plotly/tests/test_core
33+
; pytest -k 'not nodev' -x plotly/tests/test_core
3434
;
35-
; Which is a nice way to skip slow tests for faster testing cycles.
3635

3736
[tox]
3837
; The py{A,B,C}-{X,Y} generates a matrix of envs:
@@ -72,16 +71,16 @@ deps=
7271
basepython={env:PLOTLY_TOX_PYTHON_27:}
7372
commands=
7473
python --version
75-
nosetests {posargs} -x chart_studio/tests/
74+
pytest {posargs} -x chart_studio/tests/
7675

7776
[testenv:py35-plot_ly]
7877
basepython={env:PLOTLY_TOX_PYTHON_35:}
7978
commands=
8079
python --version
81-
nosetests {posargs} -x chart_studio/tests/
80+
pytest {posargs} -x chart_studio/tests/
8281

8382
[testenv:py37-plot_ly]
8483
basepython={env:PLOTLY_TOX_PYTHON_37:}
8584
commands=
8685
python --version
87-
nosetests {posargs} -x chart_studio/tests/
86+
pytest {posargs} -x chart_studio/tests/

packages/python/plotly/optional-requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ numpy
1414
## testing dependencies ##
1515
coverage==4.3.1
1616
mock==2.0.0
17-
nose==1.3.3
1817
pytest==3.5.1
1918
backports.tempfile==1.0
2019
xarray

packages/python/plotly/tox.ini

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@
2424
; PASSING ADDITONAL ARGUMENTS TO TEST COMMANDS
2525
; The {posargs} is tox-specific and passes in any command line args after `--`.
2626
; For example, given the testing command in *this* file:
27-
; nosetests {posargs} -x plotly/tests/test_core
27+
; pytest {posargs} -x plotly/tests/test_core
2828
;
2929
; The following command:
30-
; tox -- -a '!slow'
30+
; tox -- -k 'not nodev'
3131
;
3232
; Tells tox to call:
33-
; nosetests -a '!slow' -x plotly/tests/test_core
33+
; pytest -k 'not nodev' -x plotly/tests/test_core
3434
;
35-
; Which is a nice way to skip slow tests for faster testing cycles.
3635

3736
[tox]
3837
; The py{A,B,C}-{X,Y} generates a matrix of envs:

0 commit comments

Comments
 (0)