Skip to content

Conversation

@smark-1
Copy link
Contributor

@smark-1 smark-1 commented Nov 22, 2024

when I run docker compose exec -w /code/wagtail web python runtests.py --parallel the tests run significantly faster then when I run docker compose exec -w /code/wagtail web python runtests.py without --parallel.

CPU, Memory, and Disk usage appear to be approximately the same. So adding this to the make file would be a big win for me.

Makefile Outdated
Comment on lines 43 to 44
test: ## Run all wagtail tests or pass in a file with `make test file=wagtail.admin.tests.test_name`
docker compose exec -w /code/wagtail web python runtests.py $(file) $(FILE)
docker compose exec -w /code/wagtail web python runtests.py $(file) $(FILE) --parallel
Copy link
Member

Choose a reason for hiding this comment

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

We should probably add a separate command for this (or make it possible to pass additional arguments to make test to be passed on to runtests.py). Running tests in parallel is definitely much faster, but sometimes Django/unittest cannot produce a helpful traceback due to some pickling issues, in which case you'd still want to run it in serial.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We could perhaps just add a separate command that runs in parallel for time being? E.g. have both make test and make test-parallel in the Makefile. @smark-1 could you change the PR so that we have these two commands?

Unless @laymonage has a goto solution for passing arguments from the make command, which to me seems like a slightly bigger task.

Copy link
Member

Choose a reason for hiding this comment

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

I don't have the solution and yep it is quite a task in itself, so I just put it in parentheses in case we do want to figure that one out 😆

But yes, I'm happy with just a separate command!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@saevarom I updated the PR. I am not sure what the best way to document this is.

  1. test-parallel be a new subsection in the docs?
  2. Or should be mentioned as an comment above each make test ... option?
  3. Or a paragraph somewhere saying your can replace make test with make test-parallel to run faster but it sometimes cannot produce a helpful traceback?
  4. other?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@laymonage if https://github.com/ionelmc/python-tblib is used/installed as another dependency would that fix the traceback/pickling issues? Would it then be make sense to set the tests to run in parallel by default?

Copy link
Member

Choose a reason for hiding this comment

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

tblib is already included as part of Wagtail's testing dependencies, but from my experience there are still cases where it fails to produce a helpful traceback, particularly when there's an error during template rendering. See also: https://code.djangoproject.com/ticket/29023

@smark-1 smark-1 requested a review from laymonage May 8, 2025 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants