-
Notifications
You must be signed in to change notification settings - Fork 337
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
|
||
import pytest | ||
import pytest_twisted | ||
from twisted.internet import defer, reactor | ||
from twisted.internet import reactor | ||
from twisted.web.client import Agent, FileBodyProducer | ||
from twisted.web.http_headers import Headers | ||
from twisted.web.static import File | ||
|
@@ -45,7 +45,7 @@ def on_connect(result): | |
def test_disconnect(self): | ||
d = self.deluge_web.web_api.connect(self.host_id) | ||
|
||
@defer.inlineCallbacks | ||
@pytest_twisted.inlineCallbacks | ||
def on_connect(result): | ||
assert self.deluge_web.web_api.connected() | ||
yield self.deluge_web.web_api.disconnect() | ||
|
@@ -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 commentThe 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:
|
||
def get_host_status(self): | ||
host = list(self.deluge_web.web_api.hostlist.get_host_info(self.host_id)) | ||
host[3] = 'Online' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,13 +21,13 @@ | |
# isort:imports-thirdparty | ||
from gi.repository.GLib import set_prgname | ||
from gi.repository.Gtk import Builder, ResponseType | ||
from twisted.internet import defer, gtk3reactor | ||
from twisted.internet import defer, gireactor | ||
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 commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Does it though? the current requirement spec is:
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 |
||
except ReactorAlreadyInstalledError: | ||
# Running unit tests so already installed a rector | ||
from twisted.internet import reactor | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
-r requirements.txt | ||
-r requirements-tests.txt | ||
pytest | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
libtorrent==2.0.7 | ||
pytest==7.4.2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
libtorrent | ||
libtorrent==2.0.7 | ||
pytest | ||
pytest-twisted | ||
pytest-cov | ||
|
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.