Skip to content

Commit

Permalink
Merge pull request #8882 from readthedocs/sep-debug-reaq
Browse files Browse the repository at this point in the history
  • Loading branch information
humitos authored Feb 3, 2022
2 parents 1d6cd99 + 84a2f28 commit 3d4d3cb
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 21 deletions.
1 change: 1 addition & 0 deletions dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ RUN ln -s /usr/bin/python3 /usr/bin/python
WORKDIR /tmp

COPY requirements/pip.txt pip.txt
COPY requirements/debug.txt debug.txt
COPY requirements/docker.txt docker.txt
RUN pip3 install --no-cache-dir -r docker.txt

Expand Down
13 changes: 8 additions & 5 deletions docs/dev/tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ paths. Before testing, make sure you have Tox installed:

.. prompt:: bash

pip install tox
pip install tox

To run the full test and lint suite against your changes, simply run Tox. Tox
should return without any errors. You can run Tox against all of our
environments by running:

.. prompt:: bash

tox
tox

By default, tox won't run tests from search,
in order to run all test including the search tests,
Expand All @@ -31,7 +31,7 @@ you can also set the ``TOX_POSARGS`` environment variable to an empty string:

.. prompt:: bash

TOX_POSARGS='' tox
TOX_POSARGS='' tox

.. note::

Expand All @@ -40,20 +40,23 @@ you can also set the ``TOX_POSARGS`` environment variable to an empty string:

.. prompt:: bash

tox -- -m 'not search' -x
tox -- -m 'not search' -x

To target a specific environment:

.. prompt:: bash

tox -e py38
tox -e py38

The ``tox`` configuration has the following environments configured. You can
target a single environment to limit the test suite:

py38
Run our test suite using Python 3.8

py38-debug
Same as ``py38``, but there are some useful debugging tools available in the environment.

lint
Run code linting using `Prospector`_. This currently runs `pylint`_,
`pyflakes`_, `pep8`_ and other linting tools.
Expand Down
9 changes: 7 additions & 2 deletions readthedocs/api/v3/tests/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,5 +167,10 @@ def assertDictEqual(self, d1, d2):
It's just a helper for debugging API responses.
"""
import datadiff
return super().assertDictEqual(d1, d2, datadiff.diff(d1, d2))
message = ''
try:
import datadiff
message = datadiff.diff(d1, d2)
except ImportError:
pass
return super().assertDictEqual(d1, d2, message)
4 changes: 4 additions & 0 deletions requirements/debug.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Useful tools during a debug session.
datadiff==2.0.0
ipdb==0.13.9
pdbpp==0.10.3
12 changes: 3 additions & 9 deletions requirements/docker.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Requirements for our local docker development

-r pip.txt
-r debug.txt

# https://www.psycopg.org/docs/install.html#psycopg-vs-psycopg-binary
psycopg2-binary==2.9.2 # pyup: ignore

Expand All @@ -9,16 +11,8 @@ django-redis-cache==3.0.0
# For resizing images
pillow==9.0.0

# local debugging tools
# Local debugging tools
watchdog==2.1.6
datadiff==2.0.0
ipdb==0.13.9
pdbpp==0.10.3

# jedi 0.18 is incompatible with ipython
# https://github.com/ipython/ipython/issues/12740
jedi>0.17,<0.18 # pyup: ignore

# watchdog dependency
argh==0.26.2

Expand Down
4 changes: 0 additions & 4 deletions requirements/testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,4 @@ Mercurial==6.0.1
yamale==2.2.0 # pyup: <3.0
pytest-mock==3.6.1

# local debugging tools
datadiff==2.0.0
ipdb==0.13.9

requests-mock==1.9.3
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ setenv =
LC_ALL=en_US.UTF-8
DJANGO_SETTINGS_SKIP_LOCAL=True
passenv = CI TRAVIS TRAVIS_* HOME
deps = -r{toxinidir}/requirements/testing.txt
deps =
-r{toxinidir}/requirements/testing.txt
debug: -r{toxinidir}/requirements/debug.txt
changedir = {toxinidir}/readthedocs
basepython =
python3.8
Expand Down

0 comments on commit 3d4d3cb

Please sign in to comment.