Skip to content

Fix pytest deprecation warning#440

Merged
auvipy merged 1 commit into
celery:mainfrom
mrcljx:fix-pytest-warning
Jan 29, 2026
Merged

Fix pytest deprecation warning#440
auvipy merged 1 commit into
celery:mainfrom
mrcljx:fix-pytest-warning

Conversation

@mrcljx

@mrcljx mrcljx commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

Running tests in verbose mode I noticed this warning:

t/unit/test_spawn.py::test_spawn::test_start
  site-packages/_pytest/python.py:170: PytestReturnNotNoneWarning: Test functions should return None, but t/unit/test_spawn.py::test_spawn::test_start returned <class 'int'>.
  Did you mean to use `assert` instead of `return`?
  See https://docs.pytest.org/en/stable/how-to/assert.html#return-not-none for more information.

Fixed it by replacing return with assert

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates a unit test to comply with pytest’s requirement that tests return None, eliminating a deprecation warning by asserting on the process exit code instead of returning it.

Changes:

  • Replaced return p.exitcode in test_start with an assertion that p.exitcode == 0 to align with pytest best practices and remove PytestReturnNotNoneWarning.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@auvipy auvipy merged commit b113d93 into celery:main Jan 29, 2026
17 checks passed
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