mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-15 16:12:51 +11:00
67 lines
1.9 KiB
ReStructuredText
67 lines
1.9 KiB
ReStructuredText
.. _testing:
|
|
|
|
=======
|
|
Testing
|
|
=======
|
|
|
|
Testing with Tox
|
|
================
|
|
|
|
dpaste is continuously tested online with Travis_. You can also run the test
|
|
suite locally with tox_. Tox automatically tests the project against multiple
|
|
Python and Django versions.
|
|
|
|
.. code-block:: bash
|
|
|
|
$ pip install tox
|
|
|
|
Then simply call it from the project directory.
|
|
|
|
.. code-block:: bash
|
|
|
|
$ cd dpaste/
|
|
$ tox
|
|
|
|
.. code-block:: text
|
|
:caption: Example tox output:
|
|
|
|
$ tox
|
|
|
|
py35-django-111 create: /tmp/tox/dpaste/py35-django-111
|
|
SKIPPED:InterpreterNotFound: python3.5
|
|
py36-django-111 create: /tmp/tox/dpaste/py36-django-111
|
|
py36-django-111 installdeps: django>=1.11,<1.12
|
|
py36-django-111 inst: /tmp/tox/dpaste/dist/dpaste-3.0a1.zip
|
|
|
|
...................
|
|
----------------------------------------------------------------------
|
|
Ran 48 tests in 1.724s
|
|
OK
|
|
|
|
|
|
SKIPPED: py35-django-111: InterpreterNotFound: python3.5
|
|
SKIPPED: py35-django-20: InterpreterNotFound: python3.5
|
|
py36-django-111: commands succeeded
|
|
py36-django-20: commands succeeded
|
|
congratulations :)
|
|
|
|
Type Annotation
|
|
===============
|
|
|
|
Type annotation can be added automatically using MonkeyType_.
|
|
|
|
.. code-block:: bash
|
|
|
|
# Generate the database
|
|
docker-compose run --rm app monkeytype -c dpaste.monkeytype:config run /usr/local/bin/pytest dpaste/
|
|
|
|
# List available modules
|
|
docker-compose run --rm app monkeytype -c dpaste.monkeytype:config list-modules
|
|
|
|
# Apply them one by one.
|
|
docker-compose run --rm app monkeytype -c dpaste.monkeytype:config stub <module-name> --ignore-existing-annotations
|
|
docker-compose run --rm app monkeytype -c dpaste.monkeytype:config apply <module-name> --ignore-existing-annotations
|
|
|
|
.. _Travis: https://travis-ci.org/bartTC/dpaste
|
|
.. _tox: http://tox.readthedocs.org/en/latest/
|
|
.. _MonkeyType: https://monkeytype.readthedocs.io/en/stable/
|