From 11fe22e4cd283290baad8f7e506d975a2f036d60 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Wed, 2 Mar 2022 12:35:20 +0000 Subject: [PATCH] [Tests] Remove reference to Twisted Trial With the move to pytest remove remainings documentation or comments that refer to Trial. --- .gitignore | 1 - .../Stats/deluge_stats/tests/test_stats.py | 5 ++-- .../deluge_webui/tests/test_plugin_webui.py | 3 +- deluge/tests/test_transfer.py | 1 - deluge/ui/gtk3/gtkui.py | 2 +- docs/source/contributing/testing.md | 28 +++++-------------- tox.ini | 6 ---- 7 files changed, 11 insertions(+), 35 deletions(-) diff --git a/.gitignore b/.gitignore index 70988729d..15fb2aa88 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,6 @@ docs/source/modules/deluge*.rst __pycache__/ *.py[cod] *.tar.* -_trial_temp .tox/ deluge/i18n/*/ deluge.pot diff --git a/deluge/plugins/Stats/deluge_stats/tests/test_stats.py b/deluge/plugins/Stats/deluge_stats/tests/test_stats.py index ce3bafa1f..9c66ee107 100644 --- a/deluge/plugins/Stats/deluge_stats/tests/test_stats.py +++ b/deluge/plugins/Stats/deluge_stats/tests/test_stats.py @@ -6,7 +6,6 @@ import pytest import pytest_twisted from twisted.internet import defer -from twisted.trial import unittest import deluge.component as component from deluge.common import fsize, fspeed @@ -38,7 +37,7 @@ class TestStatsPlugin: def test_client_totals(self): plugins = yield client.core.get_available_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() assert totals['total_upload'] == 0 @@ -51,7 +50,7 @@ class TestStatsPlugin: def test_session_totals(self): plugins = yield client.core.get_available_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() assert totals['total_upload'] == 0 diff --git a/deluge/plugins/WebUi/deluge_webui/tests/test_plugin_webui.py b/deluge/plugins/WebUi/deluge_webui/tests/test_plugin_webui.py index 986ccb970..1badedca0 100644 --- a/deluge/plugins/WebUi/deluge_webui/tests/test_plugin_webui.py +++ b/deluge/plugins/WebUi/deluge_webui/tests/test_plugin_webui.py @@ -7,7 +7,6 @@ # import pytest import pytest_twisted -from twisted.trial import unittest import deluge.component as component from deluge.core.core import Core @@ -36,7 +35,7 @@ class TestWebUIPlugin: def test_enable_webui(self): 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') diff --git a/deluge/tests/test_transfer.py b/deluge/tests/test_transfer.py index 17a951b9a..92e349b5d 100644 --- a/deluge/tests/test_transfer.py +++ b/deluge/tests/test_transfer.py @@ -246,7 +246,6 @@ class TestDelugeTransferProtocol: assert rencode.dumps(self.msg1) == rencode.dumps(message3) # 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): """ This test tries to test the protocol that relies on errors from rencode. diff --git a/deluge/ui/gtk3/gtkui.py b/deluge/ui/gtk3/gtkui.py index 50323d229..ddb2eb529 100644 --- a/deluge/ui/gtk3/gtkui.py +++ b/deluge/ui/gtk3/gtkui.py @@ -29,7 +29,7 @@ try: # Install twisted reactor, before any other modules import reactor. reactor = gtk3reactor.install() except ReactorAlreadyInstalledError: - # Running unit tests so trial already installed a rector + # Running unit tests so already installed a rector from twisted.internet import reactor # isort:imports-firstparty diff --git a/docs/source/contributing/testing.md b/docs/source/contributing/testing.md index 4df8ca669..beb30a41c 100644 --- a/docs/source/contributing/testing.md +++ b/docs/source/contributing/testing.md @@ -1,10 +1,6 @@ # Running tests -Deluge testing is implemented using Trial which is Twisted's testing 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 uses [PyTest] framework and [PyTest-Twisted] to handle Twisted framework. ## 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. 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 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: tox -l - py27 py3 lint docs @@ -54,11 +39,12 @@ All the tests for Deluge can be run using [Tox](https://pypi.python.org/pypi/tox tox -e lint -## Travis CI +## CI -Deluge develop branch is tested automatically by [Travis]. -When creating a pull request (PR) on [github], Travis will automatically run -the unit tests with the code in the PR. +Deluge develop branch is tested automatically by GitHub actions. + +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 +[pytest]: https://docs.pytest.org/en/ +[pytest-twisted]: https://github.com/pytest-dev/pytest-twisted diff --git a/tox.ini b/tox.ini index 8f6810cd8..405610d7c 100644 --- a/tox.ini +++ b/tox.ini @@ -81,12 +81,6 @@ commands = pytest -m "gtkui" deluge/tests [testenv:todo] 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] setenv = PYTHONPATH = {toxinidir}{:}{toxinidir}/deluge/plugins commands =