Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ my-steps: &steps
- run: sudo pip install -r requirements.txt
- run: sudo pip install flake8 pytest
- run: python --version ; pip --version ; pwd ; ls -l
- run: pip install --user .
# stop the build if there are Python syntax errors or undefined names
- run: flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
- run: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
#- run: pytest # test_s2gs test_replays
- run: python -m unittest discover test_s2gs
- run: python -m unittest discover test_replays
- run: pytest

jobs:
Python2:
Expand Down
29 changes: 22 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -259,21 +259,36 @@ Please review the `CONTRIBUTING.md`_ file and get in touch with us before doing
Testing
-------------------

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.
We use ``pytest`` for testing. If you don't have it just ``pip install pytest``.

To run the tests just use::
To run the tests, just do::

python test_replays/test_all.py
python test_s2gs/test_all.py
pytest

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::

SC2READER_CACHE_DIR=local_cache PYTHONPATH=. python -m unittest test_replays.test_all
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.
So make some local cache folder::

mkdir cache

And then run the tests like this::

SC2READER_CACHE_DIR=./cache pytest

To run just one test:

SC2READER_CACHE_DIR=local_cache PYTHONPATH=. python -m unittest test_replays.test_all.TestReplays.test_38749
SC2READER_CACHE_DIR=./cache pytest test_replays/test_replays.py::TestReplays::test_38749

If you'd like to see which are the 10 slowest tests (to find performance issues maybe)::

pytest --durations=10

If you want ``pytest`` to stop after the first failing test::

pytest -x


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

Good luck, have fun!

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
},

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