| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
Added pyupgrade utility with manual stage to pre-commit and run on all
files.
Ref: https://github.com/asottile/pyupgrade
Closes: deluge-torrent/deluge#326
|
|
|
|
|
|
|
|
|
| |
* Removed all __future__ imports from code
* Removed all six dependencies
* Removed all future_builtins imports
* Removed all Python 2 related code
Closes: deluge-torrent/deluge#325
|
|
|
|
|
|
|
| |
A quick fix of some of the mistakes caught by codespell.
Updated readme with new IRC server
Useful to add it as part of linting checks.
|
|
|
|
|
|
| |
The % substitution was causing the bytes prefix to become part of the
string and created a `b'/` prefixed config directory. Ensure the config
arg is byte prefixed too.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The move to using auto-formatter makes it easier to read, submit and
speeds up development time. https://github.com/ambv/black/
Although I would prefer 79 chars, the default line length of 88 chars
used by black suffices. The flake8 line length remains at 120 chars
since black does not touch comments or docstrings and this will require
another round of fixes.
The only black setting that is not standard is the use of double-quotes
for strings so disabled any formatting of these. Note however that
flake8 will still flag usage of double-quotes. I may change my mind on
double vs single quotes but for now leave them.
A new pyproject.toml file has been created for black configuration.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Some new flake8 checkers were added so fix these new warnings and
any issues uncovered.
Use add-trailing-comma to fix missing trailing commas. It does not
format it as well as I would like however it was fast to change and
helps with git changes in future.
Removed pylint from tox due to large number of warnings.
|
|
|
|
|
|
|
| |
* Add host Edit button to WebUI.
* Updated and fixed associated tests.
* Refactored related gtkui code to better understand code flow.
* Removed dead code in gtkui.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Preparation work for using six or future module for Py2/3 compat. The
code will be written in Python 3 with Python 2 fallbacks.
- Added some Py3 imports with Py2 fallbacks to make it easier to remove
Py2 code in future.
- Replace xrange with range (sort out import as top of files in future).
- Workaround Py2to3 basestring issue with inline if in instances. This means
every usage of basestring is more considered.
- Replace iteritems and itervalues for items and values. There might be a
performance penalty on Py2 so might need to revisit this change.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Added `from __future__ import unicode_literals` to every file so
now all strings in code are forced to be unicode strings unless
marked as byte string `b'str'` or encoded to byte string `'str'.encode('utf-8')`.
This is a large change but we have been working towards the goal of unicode
strings passed in the code so decoding external input and encoding
output as byte strings (where applicable).
Note that in Python 2 the `str` type still refers to byte strings.
* Replaced the use of `str` for `basestring` in isinstance comparison as
this was the original intention but breaks code when encoutering unicode strings.
* Marked byte strings in gtkui as the conversion to utf8 is not always handled, mostly
related to gobject signal names.
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
From pep8-naming:
* N802: function name should be lowercase
* N803: argument name should be lowercase
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* A rather disruptive change but for a few reasons such as easier to read,
easier type, keep consistent and javascript code uses single quotes.
* There are a few exceptions for the automated process:
* Any double quotes in comments
* Triple double quotes for docstrings
* Strings containing single quotes are left e.g. "they're"
* To deal with merge conflicts from feature branches it is best to follow
these steps for each commit:
* Create a patch: `git format-patch -1 <sha1>`
* Edit the patch and replace double quotes with single except those in
comments or strings containing an unescaped apostrophe.
* Check the patch `git apply --check <patchfile>` and fix any remaining
issues if it outputs an error.
* Apply the patch `git am < <patchfile>`
|
| |
|
|
|
|
| |
This reverts commit 8b50f3cdbdec4f2fa622aca9d0e4b45e5e4bf3aa.
|
|
|
|
|
|
|
|
| |
To make the code more Python 3 compatible, I've made a few changes to how we handle keys() or iterkeys() calls on dictionaries. All functionality should remain the same.
* Remove the use of .keys() or .iterkeys() when iterating through a dictionary.
* Remove the use of .keys() when checking if key exists in dictionary.
* Replace dict.keys() with list(dict) to obtain a list of dictionary keys. In Python 3 dict.keys() returns a dict_keys object, not a list.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This should fix problems with errors occuring when failing to
enable plugins. Errors in plugin handling are handled better
and properly logged.
WebUI plugin in particular had issues when being enabled and disabled
multiple times because it was trying to create DelugeWeb component
each time it was enabled. If deluge-web is already listening on
the same port, enabling the WebUI plugin will fail, and the checkbox
will not be checked.
There are still some issues when enabling/disabling plugins by
clicking fast multiple times on the checkbox.
|
|
|
|
|
| |
optparse is deprecation and succeeded by argparse. See
https://www.python.org/dev/peps/pep-0389
|
|
|
|
|
|
|
| |
* Replace Popen with reactor.spawnProcess and read process
output with twisted.internet.protocol.ProcessProtocol
* Implement support for running custom script code
* Now logs to stdout instead of stderr when not logging to file
|
|
|
|
|
| |
* Uses isinstance() instead of type()
* Uses sorted() where possible
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Selected Warning messages disabled in pylintrc:
* unused-argument: Quite a large and disruptive change if enabled.
* broad-except: Most required in-depth investigation to determine type.
* fixme: Not important
* protected-access: Complicated to fix
* import-error: Too many false-positives
* unidiomatic-typecheck: Should be fixed in the next round of checks.
* unused-variable: Again large and disruptive changes.
* global-statement: Most usage is required.
* attribute-defined-outside-init: Should be fixed in next round of checks.
* arguments-differ: Possible false-positives, needs revisited.
* no-init, non-parent-init-called, super-init-not-called: False-positives?
* signature-differs: False-positives?
|
|
|
|
| |
Fixes error E265 and E714 that have been added to newest version of pep8
|
|
|
|
| |
* Use the inline '# NOQA' to supress N802 lower-case warnings
|
|
|
|
|
|
| |
* Added N802 to flake8 ignore as certain inherited funcs cannot be changed
to lowercase and this unresolved warning hides other errors/warnings.
* Include new header
|
| |
|
|
|
|
|
| |
* Use 'ex' instead of 'e' to conform with pylint
* Minimal Flake8 on some files
|
| |
|
| |
|
|
|
|
|
| |
* Removed all the properties in error.py and added more tests
* Handle failure in client.py handling RPC_ERROR (From older daemons)
|
|
|
|
| |
localhost auth file details
|
|
|
|
|
| |
Fix a few places that use those arguments.
Make sure gtkui loads strings as unicode from rencode.
|
|
|
|
|
| |
The use of Popen was originally a fix for a Win32 issue on 1.3 but makes sense to
apply to all OSs and simplify code.
|
| |
|
| |
|
|
|
|
|
|
| |
Implemented a protocol layer above twisted.internet.protocol.Protocol
which guarantees correct transfer of RPC messages. The network messages
are transfered with a header containing the length of the message.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
While adding the multiuser auth related stuff, RPC_AUTH_EVENT was added, simply to not touch how RPC_ERROR was handled. It was created to allow recreating the exception on the client side. Instead of adding another rpc event type, extend RPC_ERROR to send the proper data to recreate the exception on the client side.
|
|
|
|
| |
GTK UI.
|
|
|
|
| |
Force clients prior to 1.4 to fail authentication, this was we might reduce tickets like #1852.
|