[Tests] Remove reference to Twisted Trial

With the move to pytest remove remainings documentation or comments that
refer to Trial.
This commit is contained in:
Calum Lind 2022-03-02 12:35:20 +00:00
parent a683b7e830
commit 11fe22e4cd
No known key found for this signature in database
GPG Key ID: 90597A687B836BA3
7 changed files with 11 additions and 35 deletions

1
.gitignore vendored
View File

@ -10,7 +10,6 @@ docs/source/modules/deluge*.rst
__pycache__/ __pycache__/
*.py[cod] *.py[cod]
*.tar.* *.tar.*
_trial_temp
.tox/ .tox/
deluge/i18n/*/ deluge/i18n/*/
deluge.pot deluge.pot

View File

@ -6,7 +6,6 @@
import pytest import pytest
import pytest_twisted import pytest_twisted
from twisted.internet import defer from twisted.internet import defer
from twisted.trial import unittest
import deluge.component as component import deluge.component as component
from deluge.common import fsize, fspeed from deluge.common import fsize, fspeed
@ -38,7 +37,7 @@ class TestStatsPlugin:
def test_client_totals(self): def test_client_totals(self):
plugins = yield client.core.get_available_plugins() plugins = yield client.core.get_available_plugins()
if 'Stats' not in plugins: if 'Stats' not in plugins:
raise unittest.SkipTest('WebUi plugin not available for testing') pytest.skip('Stats plugin not available for testing')
totals = yield client.stats.get_totals() totals = yield client.stats.get_totals()
assert totals['total_upload'] == 0 assert totals['total_upload'] == 0
@ -51,7 +50,7 @@ class TestStatsPlugin:
def test_session_totals(self): def test_session_totals(self):
plugins = yield client.core.get_available_plugins() plugins = yield client.core.get_available_plugins()
if 'Stats' not in plugins: if 'Stats' not in plugins:
raise unittest.SkipTest('WebUi plugin not available for testing') pytest.skip('Stats plugin not available for testing')
totals = yield client.stats.get_session_totals() totals = yield client.stats.get_session_totals()
assert totals['total_upload'] == 0 assert totals['total_upload'] == 0

View File

@ -7,7 +7,6 @@
# #
import pytest import pytest
import pytest_twisted import pytest_twisted
from twisted.trial import unittest
import deluge.component as component import deluge.component as component
from deluge.core.core import Core from deluge.core.core import Core
@ -36,7 +35,7 @@ class TestWebUIPlugin:
def test_enable_webui(self): def test_enable_webui(self):
if 'WebUi' not in self.core.get_available_plugins(): if 'WebUi' not in self.core.get_available_plugins():
raise unittest.SkipTest('WebUi plugin not available for testing') pytest.skip('WebUi plugin not available for testing')
d = self.core.enable_plugin('WebUi') d = self.core.enable_plugin('WebUi')

View File

@ -246,7 +246,6 @@ class TestDelugeTransferProtocol:
assert rencode.dumps(self.msg1) == rencode.dumps(message3) assert rencode.dumps(self.msg1) == rencode.dumps(message3)
# Remove underscore to enable test, or run the test directly: # Remove underscore to enable test, or run the test directly:
# tests $ trial test_transfer.DelugeTransferProtocolTestCase._test_rencode_fail_protocol
def _test_rencode_fail_protocol(self): def _test_rencode_fail_protocol(self):
""" """
This test tries to test the protocol that relies on errors from rencode. This test tries to test the protocol that relies on errors from rencode.

View File

@ -29,7 +29,7 @@ try:
# Install twisted reactor, before any other modules import reactor. # Install twisted reactor, before any other modules import reactor.
reactor = gtk3reactor.install() reactor = gtk3reactor.install()
except ReactorAlreadyInstalledError: except ReactorAlreadyInstalledError:
# Running unit tests so trial already installed a rector # Running unit tests so already installed a rector
from twisted.internet import reactor from twisted.internet import reactor
# isort:imports-firstparty # isort:imports-firstparty

View File

@ -1,10 +1,6 @@
# Running tests # Running tests
Deluge testing is implemented using Trial which is Twisted's testing framework Testing uses [PyTest] framework and [PyTest-Twisted] to handle Twisted framework.
and an extension of Python's unittest.
See Twisted website for documentation on [Twisted Trial](http://twistedmatrix.com/trac/wiki/TwistedTrial)
and [Writing tests using Trial](http://twistedmatrix.com/documents/current/core/howto/testing.html).
## Testing ## Testing
@ -12,16 +8,6 @@ The tests are located in the source folder under `deluge/tests`.
The tests are run from the project root directory. The tests are run from the project root directory.
View the unit test coverage at: [deluge-torrent.github.io](http://deluge-torrent.github.io) View the unit test coverage at: [deluge-torrent.github.io](http://deluge-torrent.github.io)
### Trial
Here are some examples that show running all the tests through to selecting an
individual test.
trial deluge
trial deluge.tests.test_client
trial deluge.tests.test_client.ClientTestCase
trial deluge.tests.test_client.ClientTestCase.test_connect_localclient
### Pytest ### Pytest
pytest deluge/tests pytest deluge/tests
@ -41,7 +27,6 @@ All the tests for Deluge can be run using [Tox](https://pypi.python.org/pypi/tox
### See available targets: ### See available targets:
tox -l tox -l
py27
py3 py3
lint lint
docs docs
@ -54,11 +39,12 @@ All the tests for Deluge can be run using [Tox](https://pypi.python.org/pypi/tox
tox -e lint tox -e lint
## Travis CI ## CI
Deluge develop branch is tested automatically by [Travis]. Deluge develop branch is tested automatically by GitHub actions.
When creating a pull request (PR) on [github], Travis will automatically run
the unit tests with the code in the PR. When creating a pull request (PR) on [github], units tests will be automatically be run.
[travis]: https://travis-ci.org/deluge-torrent/deluge
[github]: https://github.com/deluge-torrent/deluge/pulls [github]: https://github.com/deluge-torrent/deluge/pulls
[pytest]: https://docs.pytest.org/en/
[pytest-twisted]: https://github.com/pytest-dev/pytest-twisted

View File

@ -81,12 +81,6 @@ commands = pytest -m "gtkui" deluge/tests
[testenv:todo] [testenv:todo]
commands = pytest -m "todo" deluge/tests commands = pytest -m "todo" deluge/tests
[testenv:trial]
setenv = {[testenv]setenv}{:}{toxinidir}/deluge/tests
commands =
python -c "import libtorrent as lt; print(lt.__version__)"
python -m twisted.trial --reporter=deluge-reporter deluge.tests
[testenv:plugins] [testenv:plugins]
setenv = PYTHONPATH = {toxinidir}{:}{toxinidir}/deluge/plugins setenv = PYTHONPATH = {toxinidir}{:}{toxinidir}/deluge/plugins
commands = commands =