Skip to content

Commit 17530b1

Browse files
author
Dominik Neise
committed
add docs for testing
1 parent fcd3842 commit 17530b1

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

README.rst

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -259,21 +259,36 @@ Please review the `CONTRIBUTING.md`_ file and get in touch with us before doing
259259
Testing
260260
-------------------
261261

262-
We use the built in ``unittest`` module for testing. If you are still on Python 2.6 you will need to install ``unittest2`` because our test suite requires newer features than are included in the main distribution.
262+
We use ``pytest`` for testing. If you don't have it just ``pip install pytest``.
263263

264-
To run the tests just use::
264+
To run the tests, just do::
265265

266-
python test_replays/test_all.py
267-
python test_s2gs/test_all.py
266+
pytest
268267

269-
When repeatedly running tests it can be very helpful to make sure you've set a local cache directory to prevent long fetch times from battle.net::
270268

271-
SC2READER_CACHE_DIR=local_cache PYTHONPATH=. python -m unittest test_replays.test_all
269+
When repeatedly running tests it can be very helpful to make sure you've set a local cache directory to prevent long fetch times from battle.net.
270+
So make some local cache folder::
271+
272+
mkdir cache
273+
274+
And then run the tests like this::
275+
276+
SC2READER_CACHE_DIR=./cache pytest
272277

273278
To run just one test:
274279

275-
SC2READER_CACHE_DIR=local_cache PYTHONPATH=. python -m unittest test_replays.test_all.TestReplays.test_38749
280+
SC2READER_CACHE_DIR=./cache pytest test_replays/test_replays.py::TestReplays::test_38749
281+
282+
If you'd like to see which are the 10 slowest tests (to find performance issues maybe)::
283+
284+
pytest --durations=10
285+
286+
If you want ``pytest`` to stop after the first failing test::
287+
288+
pytest -x
289+
276290

291+
Have a look at the very fine ``pytest`` docs for more information.
277292

278293
Good luck, have fun!
279294

0 commit comments

Comments
 (0)