* Ensure all file descriptors are closed. Using the with statement ensures
closure.
* The main problem was with thousands of unclosed file desciptors from
tracker_icons mkstemp.
* Use a prefix 'deluge_ticon.' to identify created tracker_icon tmp files.
* Testcases in test_torrent.py and test_torrentmanager.py creates
components and should therefore inherit from BaseTestCase.
* Cleanup in test_json_api.py
Current solution for passing arguments to UI when invoking deluge
entry script is to select an UI with the --ui option and supply quoted
arguments with the --args option.
This patch cleans this up by removing both options and change to using
subparsers for valid UIs. All command line options are now parsed
directly by the child UI which is chosen by a positional argument,
i.e. the UI name.
The help text now also shows the current default UI.
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.
* pylintrc is now compatible with pylint 1.6.
* Add to ignore wrong-import-position and wrong-import-order as
we use isort and pylint is raising too many incorrect messages.
* 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
For some reason, the time.sleep calls in the tests in
test_sessionproxy did not sleep for the expected amount
of time causing the results to differ from the expected.
Fixed by replacing time.time function with twisted's
task.clock.seconds and advancing the clock manually.
Also minor changes to test_client.py
Add __str__ to WrappedException so that the stacktrace is printed when a
unit test raises a WrappedException.
Change the log output from error to warning in DelugeRPCProtocol.dispatch
when sending back a raised exception on an RPC request.
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?
Disabled Conventions messages:
* missing-docstring: Not likely all methods/funcs will ever have docstrings.
* invalid-name: Far too many too fix so will simply have to ensure submitted
or altered code keeps to the convention.
* old-style-class: Not a priority but would be nice to eventually fix this.
* bad-continuation: Occasionally conflicts with pep8, not worth enabling if using
pyflakes and pep8 as these will catch most continuation issues.
* Include a pylintrc config file
* This commit provides a basic error-only pylint config as a starting
point with a view to adding more checks incrementally to keep the volume
of changes low and the code able to pass pylint at each stage.
* Further whitespace fixes by autopep8
* Using pep8 v1.6.2 (not currently used by pyflakes)
* Update config for pep8 and flake8 in tox.ini
* A separate pep8 entry for running autopep8. The ignores prevent
blank lines being added after docstrings.
* .tox and E133 are ignored in flake8 by default.