Skip to content

Commit 222230a

Browse files
authored
Merge pull request #84 from dneise/allow_pytest
Allow pytest
2 parents f7550f2 + 5cd2b84 commit 222230a

File tree

4 files changed

+25
-10
lines changed

4 files changed

+25
-10
lines changed

.circleci/config.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ my-steps: &steps
55
- run: sudo pip install -r requirements.txt
66
- run: sudo pip install flake8 pytest
77
- run: python --version ; pip --version ; pwd ; ls -l
8+
- run: pip install --user .
89
# stop the build if there are Python syntax errors or undefined names
910
- run: flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
1011
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
1112
- run: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
12-
#- run: pytest # test_s2gs test_replays
13-
- run: python -m unittest discover test_s2gs
14-
- run: python -m unittest discover test_replays
13+
- run: pytest
1514

1615
jobs:
1716
Python2:

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

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
},
4949

5050
install_requires=['mpyq>=0.2.3', 'argparse', 'ordereddict', 'unittest2', 'pil'] if float(sys.version[:3]) < 2.7 else ['mpyq>=0.2.4'],
51+
tests_require=["pytest"],
5152
packages=setuptools.find_packages(),
5253
include_package_data=True,
5354
zip_safe=True
File renamed without changes.

0 commit comments

Comments
 (0)