Convert all the twisted.trial tests to pytest_twisted. Also move off of unittest.TestCase as well. Seems there were several tests which weren't actually testing what they should, and also some code that wasn't doing what the broken test said it should.
Goals:
Remove twisted.trial tests
Move to pytest fixtures, rather than many classess and subclasses with setup and teardown functions
Move away from self.assertX to assert style tests
FIx broken tests
Going forward I think these should be the goals when adding/modifying tests:
* Don't use BaseTest or set_up tear_down methods any more. Fixtures should be used either in the test module/class, or make/improve the ones available in conftest.py
* For sure don't use unittest or twisted.trial, they mess up the pytest stuff.
* Prefer pytest_twisted.ensureDeferred with an async function over inlineCallbacks.
- I think the async function syntax is nicer, and it helps catch silly mistakes, e.g. await None is invalid, but yield None isn't, so if some function returns an unexpected thing we try to await on, it will be caught earlier. (I struggled debugging a test for quite a while, then caught it immediately when switching to the new syntax)
- Once the maybe_coroutine PR goes in, using the async syntax can also improve tracebacks when debugging tests.
Things that should probably be cleaned up going forward:
* Remove BaseTestCase
* Remove the subclasses like DaemonBase in favor of new fixtures.
* I think there are some other utility subclasses that could be removed too
* Perhaps use parameterization in the ui_entry tests, rather that the weird combination of subclasses and the set_var fixture I mixed in.
* Convert some of the callback stuff to pytest_twisted.ensureDeferred tests, just for nicer readability
Details relating to pytest fixtures conftest.py in root dir:
* https://github.com/pytest-dev/pytest/issues/5822#issuecomment-697331920
* https://docs.pytest.org/en/latest/deprecations.html#pytest-plugins-in-non-top-level-conftest-files
Closes: https://github.com/deluge-torrent/deluge/pull/354
Up until now, when closing the Add or Edit dialogs, of the `Edit Torrents`, using the top-right X
button or using the Escape key, they were being destroyed without any way to reopening them, and
it was breaking the `Edit Torrents` window itself.
Now both dialogs have the right handlers for handing the closing process without breaking anything.
Closes: deluge-torrent/deluge#324
Closes: https://dev.deluge-torrent.org/ticket/2434
Libtorrent now supports interface names instead of just IP address so
add new common functions to validate user input.
* Added is_interface that will verify if a libtorrent interface of name
or IP address.
* Added is_interface_name to verify that the name supplied is a valid
network interface name in the operating system.
On Windows sock.if_nameindex() is only supported on 3.8+ and does not
return a uuid (required by libtorrent) so use ifaddr package. Using git
commit version for ifaddr due to adapter name decode bug in v0.1.7.
On other OSes attempt to use stdlib and fallback to ifaddr if installed
otherwiser return True.
* Added tests for is_interface & is_interface_name
* Updated UIs with change from address to interface
* Updated is_ipv6 and is_ipv4 to used inet_pton; now supported on
Windows.
Ref: https://github.com/pydron/ifaddr/pull/32
Closes: https://github.com/deluge-torrent/deluge/pull/338
We should not let anyone know the account's password length,
as it can help to crack it.
Instead, we will print a constant amount (10) of asterisks.
Closes: https://github.com/deluge-torrent/deluge/pull/346
This makes the process of editing the file much more pleasant and
removes duplicate code.
Fixed collecting twisted package which brings both build speed
improvements but also decreases package size, as it stops PyInstaller
from bundling tests (actually, some tests might even execute during
import and break build if they're designed to throw!) used by
PyInstaller
Closes: https://github.com/deluge-torrent/deluge/pull/342
CirnoT reported how they felt that GTK3 is not reliable on Windows.
Seeing some weird issues where clicking Deluge icon on taskbar does
bring window to front but doing so again does not minimize it as one
would expect. By using GTK_CSD=0 this would reduce these problems.
> If changed to 0, this disables the default use of client-side
decorations on GTK windows, thus making the window manager responsible
for drawing the decorations of windows that do not have a custom
titlebar widget.
This can be overridden by a global env var.
Ref: https://github.com/deluge-torrent/deluge/pull/331#issuecomment-1012311605
Ref: https://docs.gtk.org/gtk3/running.html
this will lined-up with the WebUI, which already have this option.
in addition, it will not open the Add Torrent URL dialog after copied,
which happens automatically when there is torrent/magnet URIs in the clipboard.
Closes: deluge-torrent/deluge#328
Closes: https://dev.deluge-torrent.org/ticket/3489
Include arch in artifacts so they can be downloaded separately
Added libtorrent 2.0 to matrix since users often request latest
libtorrent.
Renamed workflow to make it's purpose clearer
libtorrent + pyinstaller requires a lib(ssl/crypto)-1_1.dll and
lib(ssl/crypto)-1_1-x64.dll odd quirk but solveable by just having
two copies. Maybe later compiling our own libtorrent.
* Rename instances of win32 to generic win or the appropriate bit where applicable
* Remove files used in GTK2
* Add spec file for use with PyInstaller
* Remove Python bbfreeze Script
* Add Github Action To Build Releases
* Add Modified script to make files used by NSIS
* Update Readme
Closes: https://github.com/deluge-torrent/deluge/pull/331
A new metadata version 2.1 has optional Description that is causing an
TypeError when looking up the key in plugin_info since clients are
assuming values are always strings but the default is None.
Fixed TypeError by ensuring that the info dict has a default empty
string set for all keys.
Separated the parsing of the pkg_info into static method to make it
easier to test.
Changed the missing plugin info to only set the Name and Version as
'not available' since all other fields are optional.
Ref: https://dev.deluge-torrent.org/ticket/3476
Ref: https://packaging.python.org/en/latest/specifications/core-metadata/#description
A UnicodeDecodeError is raised in transfer module when attempting to
prefetch a magnet.
This is result of passing a Python dict containing text bytes and raw
bytes that cannot be decoded as utf-8 in rencode when recieving the
message. This could be handled in rencode by returning raw bytes if
decoding fails (perhaps with a strict mode?) however better to follow
convention of encoding raw bytes in base64 in API calls.
Fixed by retaining bencoding and encoding with base64 when sending
result.
Resolves: https://github.com/deluge-torrent/deluge/pull/334