Skip to content

CI: Don't install debug tools when running tests #8882

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 3, 2022
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
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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth defining what is installed? Or maybe linking to the file? Not necessary though.


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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this problem was already fixed in the latest version we install


# 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't know about this syntax.

changedir = {toxinidir}/readthedocs
basepython =
python3.8
Expand Down