Skip to content
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

Don't apply monkey patches on generic start #8278

Merged
merged 1 commit into from
Jan 12, 2025
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
Partially revert "monkeypatches: Remove unused for_tests argument"
Since commit d6b698e, the monkey
patches were applied on every installs.

This implies that set_is_in_unit_tests(True) was called even when not it
in unit tests.

Because it believes being in tests, db.logs._async_iter_on_pool is
importing NonThreadPool from a submodule in the test module.
This runs the test __init__ code which sets up warnings as error by
default.

As a consequence, any Deprecation warning will trigger an exception
instead of just being shown in logs.

This is causing troubles in current v4.2.0 with out of tree modules
(which use deprecated code, granted).

This partially reverts commit d6b698e.
In addition, some patches are always run and some only during tests.

Modified-by: Povilas Kanapickas <povilas@radix.lt>
  • Loading branch information
lephilousophe authored and p12tic committed Jan 12, 2025
commit a894300c5085be925f5021bae2058492625a786b
7 changes: 4 additions & 3 deletions master/buildbot/monkeypatches/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ def patch_config_for_unit_tests():
set_is_in_unit_tests(True)


def patch_all():
def patch_all(for_tests=False):
if for_tests:
patch_testcase_timeout()
patch_config_for_unit_tests()
patch_servicechecks()
patch_testcase_timeout()
patch_decorators()
patch_config_for_unit_tests()
2 changes: 1 addition & 1 deletion master/buildbot/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
_ = mock

# apply the same patches the buildmaster does when it starts
monkeypatches.patch_all()
monkeypatches.patch_all(for_tests=True)

# enable deprecation warnings
warnings.filterwarnings('always', category=DeprecationWarning)
Expand Down
1 change: 1 addition & 0 deletions newsfragments/fix-deprecation-warnings.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed deprecation warnings being raised as errors