-
Notifications
You must be signed in to change notification settings - Fork 338
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
Ci fixes and updates #454
Ci fixes and updates #454
Conversation
e1c41ad
to
dfabeb2
Compare
a0f2a10
to
264039a
Compare
I'm afraid there are too many changes here and not enough details in the commits about why the change is required. If possible, can you split these up into more concise PRs it will help reviewing and merging |
1e247aa
to
4e1acbe
Compare
I hadn't seen this comment, sorry for not answering before. I'd rather not split it (although it IS true that there are some not-strictly related things here) because then we'll never get it merged. However, I'm more than happy to amend commit messages and/or explain why I've made each change. |
from twisted.internet.error import ReactorAlreadyInstalledError | ||
from twisted.internet.task import LoopingCall | ||
|
||
try: | ||
# Install twisted reactor, before any other modules import reactor. | ||
reactor = gtk3reactor.install() | ||
reactor = gireactor.install() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just to avoid using a deprecated class name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We support a minimum version of Twisted and afaik this would break that so needs to be reverted, I don't think they are actually removing it anytime soon. We could add a Twisted version check for the import but would need a comment to explain why gireactor is being used since the Twisted docs are now contradictory about not using it for UI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it though? the current requirement spec is:
twisted[tls]>=17.1; sys_platform != 'win32'
twisted[tls]<23,>=17.1; sys_platform == 'win32'
And the Twisted api documentation for 16.4.1, a full major version earlier (https://twisted.org/documents/16.4.1/api/twisted.internet.gireactor.html), already has the gireactor
, with an API that I think is identical?
@@ -1,4 +1,4 @@ | |||
-r requirements.txt | |||
-r requirements-tests.txt | |||
libtorrent==2.0.7 | |||
pytest==7.4.2 | |||
pytest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, pytest is pinned due to console tests failing, which is fixed by this PR.
requirements-ci.txt
Outdated
libtorrent==2.0.7 | ||
pytest==7.4.2 | ||
pytest | ||
libtorrent<2.0.9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libtorrent is pinned also due to a test failure, but the change was introduced in 2.0.9. We should eventually fix our test rather than keep pinning, but we can still update libtorrent even if just a bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are pinned to avoid breaking the CI over time so can be version bumped but must still be pinned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are pinned to avoid breaking the CI over time so can be version bumped but must still be pinned
For now, I'm happy to change it to libtorrent==2.0.8
, but I think there's a discussion to be had about this (not in the context of this PR): I can understand the desire for the CI to not break easily, especially if you have little time as-is, but IMO a CI shouldn't easily break (if at all) due to a dependency publishing new bug-fix level releases.
You're pinned to a two-year old version of what is quite probably your most important dependency. There has to be a better way to approach it (I have a few different ideas, but I don't really know where is the best place to start a discussion such as this?)
@@ -76,7 +76,7 @@ def test_set_config(self): | |||
assert config['pwd_sha1'] != web_config['pwd_sha1'] | |||
assert config['sessions'] != web_config['sessions'] | |||
|
|||
@defer.inlineCallbacks | |||
@pytest_twisted.inlineCallbacks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes are due to the pytest developers recommending that twisted not be used directly in tests with fixtures. From the pytest-twisted docs:
Using twisted.internet.defer.inlineCallbacks as a decorator for test functions, which use fixtures, does not work. Please use pytest_twisted.inlineCallbacks instead.
def test_console_command_config_set_download_location(self): | ||
fd = StringFileDescriptor(sys.stdout) | ||
self.patch_arg_command(['config --set download_location /downloads']) | ||
self.patch(sys, 'stdout', fd) | ||
|
||
yield self.exec_command() | ||
with mock.patch('deluge.ui.console.main.ConsoleUI.quit', autospec=True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was calling the real ConsoleUI.quit()
, which was stopping the reactor and thus making the tests go boom.
deluge/core/alertmanager.py
Outdated
@@ -174,7 +174,7 @@ def handle_alerts(self): | |||
d = task.deferLater(reactor, 0, handler, alert) | |||
on_handler_timeout = partial( | |||
self.on_delayed_call_timeout, | |||
handler=handler.__qualname__, | |||
handler=handler.__class__.__qualname__, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This flat-out produces an error, because __qualname__
is an attribute that classes (not their instances) have.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When does it raise an error? Handlers are functions or methods not class instances so handle.__class__.__qualname__
does not make seem to make sense here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When does it raise an error? Handlers are functions or methods not class instances so
handle.__class__.__qualname__
does not make seem to make sense here?
See this log, for an example:
https://github.com/Lord-Kamina/deluge/actions/runs/10050873417/job/27779525108
EDIT (copied the error here for ease):
deluge/tests/test_alertmanager.py::TestAlertManager::test_pop_alert
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/_pytest/threadexception.py:82: PytestUnhandledThreadExceptionWarning: Exception in thread alert-poller
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/home/runner/work/deluge/deluge/deluge/core/alertmanager.py", line 93, in wait_for_alert_in_thread
threads.blockingCallFromThread(reactor, self.maybe_handle_alerts)
File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/twisted/internet/threads.py", line 135, in blockingCallFromThread
result.raiseException()
File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/twisted/python/failure.py", line 505, in raiseException
raise self.value.with_traceback(self.tb)
File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/twisted/internet/defer.py", line 212, in maybeDeferred
result = f(*args, **kwargs)
File "/home/runner/work/deluge/deluge/deluge/core/alertmanager.py", line 113, in maybe_handle_alerts
self.handle_alerts()
File "/home/runner/work/deluge/deluge/deluge/core/alertmanager.py", line 177, in handle_alerts
handler=handler.__qualname__,
File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/unittest/mock.py", line 645, in __getattr__
raise AttributeError(name)
AttributeError: __qualname__
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although now... reading that again, it might be an issue specific to running the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cas-- I have reverted that change and implemented a proper fix in the actual test now.
@cas-- Using |
The publishing to pip seems to be intermittent, I've made an issue on libtorrent a little over a week ago about pip builds, but I haven't seen any update. There is a open PR that seems to address some of the builds/CI for libtorrent, but I'm not sure if this directly address this concern. You can see my issue and the linked PR here |
@zakkarry there were several issues with the @Lord-Kamina please revert the change to |
As I've found out recently heh. A user on the forums was asking about 3.13 support, and I told him to make an issue or PR, and he made #462 for it - it's failing some tests though it seems. |
The change to gvsbuild-release was already commited, all that's missing is for the workflow to run, which is only on a manual trigger. However, that would break the current CI. The idea would be to run it just before this PR is ready to be merged. |
I know and I was inquiring about it as well a while ago. Thing is, even if that's fixed, I doubt we'll get retroactive releases for an old version, so the point stands in that we need to be able to 1) update libtorrent and 2) have at least some CI workflow that fails anf alerts us when newer versions break, because else we're putting ourselves in the same position the folks at twisted did, which is essentially forgetting it's an issue. Of course, I'm willing to help however I can but I have essentially no experience working with libtorrent so I'm not sure that really amounts to much. What do you think @DjLegolas? |
76c9772
to
a26d731
Compare
I don't think that's at all related? |
I wasn't saying it was related necessarily, but you mentioned 3.13, so I informed you of a relevant PR to the version, that's all. |
Clarified a little what this commit actually does.
a26d731
to
8525b5f
Compare
Closing this as per #466 |
This branch updates the CI stack a bit in different ways.
test_ui_entry.py
hanging, which allows us to unpin the pytest version used.Notes: