Commit Graph

90 Commits

Author SHA1 Message Date
Calum Lind 90c5e75373
[Lint] Replace black/flake8/isort with ruff
Use ruff as a single performant tool to lint and format Python code.
2024-09-08 17:46:40 +01:00
Calum Lind d00068423f
[Tests] Ignore 3rd-party deprecation warnings in pytest
Move pytest config from tox to pyproject and ignore deprecation warning
generated in 3rd-party libraries.

Fixed GObject deprecation warning
2023-02-27 20:15:12 +00:00
DjLegolas c4b9cc7292
[tox] update tox.ini for support for `tox` 4
`tox` 4 now demands that `passenv` parameter will be comma-separated and
not space-seperated.

Closes: https://github.com/deluge-torrent/deluge/pull/409
2023-02-23 17:10:40 +00:00
Calum Lind 11fe22e4cd
[Tests] Remove reference to Twisted Trial
With the move to pytest remove remainings documentation or comments that
refer to Trial.
2022-03-02 12:45:15 +00:00
DjLegolas 897955f0a1
Remove all Python 2 support
* 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
2021-12-28 19:26:38 +00:00
Calum Lind 8a4ec493c0 [CI/CD] Add Travis windows build
* Added APPDATA to tox passenv so it is available to common module.
* Fixed windows path issue in httpdownloader tests
* Skipped torrentmanager test due to the following error from loading a
Linux pickled state file with a different line ending.
    ModuleNotFoundError: No module named 'deluge.core.torrentmanager\r'
* Removed appveyor build
2021-02-23 10:41:46 +00:00
bendikro 672e3c42a8 [Tests] Add pytest markers to tox.ini
Remove pytest warnings due to unknown markers
2020-04-23 17:19:37 +01:00
Calum Lind eb57412601 [Tests] Fix tox, pytest and travis issues
* Error occurring with Pytest 5.4 so pin to below that version.
 * Fix minor issues with Travis config.
 * Use full command-switches for pytest in tox config.
 * Remove pin for pip as issue with pip-wheel-metadata was fixed in 19.3
 * Remove tox-venv as causing issues of incompatible packages installed.
   The latest versions of the virtualenv package should handle these
   duties.
2020-04-12 17:37:42 +01:00
Calum Lind 8b62e50eb8 [Docs] Add spellchecking with pyenchant
- Use sphinxcontrib.spelling with custom wordlist.
- Skip the checking of the modules documents as they raise
false-positives.
- Add a setup.py spellcheck_docs command.
- Fix spelling and other issues.
- Add a doc favicon.
2019-06-15 21:06:27 +01:00
Calum Lind d4185505d1 [Docs] Cleanup changelog and docs 2019-06-06 17:12:58 +01:00
Calum Lind ce8595e8dd [Tests] Remove python2 from tox config 2019-06-06 11:30:45 +01:00
Calum Lind a3b6d8d8e5 [Appveyor] Switch to Python 3.6
- Change build from Python 2.7 to 3.6 64-bit.
 - Specify py36 for tox since using py3 will choose latest py3 e.g. 3.7!
 - Use python 3.6 libtorrent.pyd build
 - Use pre-installed OpenSSL 1.1 (matches libtorrent build)
 - Add python version output to tox.ini for debugging.
2019-05-23 00:15:49 +01:00
Calum Lind 65f6ede8b2 [Docs] Updates and fixes to build on Python 3
- Updates to the sphinx conf
  - Applied Mock fixes to build on Python 3.
  - Group patches at bottom of conf file.
  - Use just a major.minor for version.
  - Specify Sphinx 2.0 version requirement.
- Move requirements.txt to docs dir.
- Add readthedocs config
- Fix docstring code block rst formatting issue.
2019-05-21 15:23:45 +01:00
Calum Lind 1425fe5413 [Tox] Pin pip version to fix PEP517 issues
* Using pyproject.toml for black config pip version 19.1 errors out
   about using editable install with pyproject.toml.
   Workaround is to not use pip 19.1 in tox.
 * Pin to 18.1 to avoid pip-wheel-metadata-folder creation

Ref:
 - https://github.com/pypa/pip/issues/6434
 - https://github.com/pypa/pip/issues/6213
2019-05-03 14:53:34 +01:00
Calum Lind 97e7d95dd3 Cleanup tox configuration
There were issues with dependencies and tox environments under Python 3
so refactored the tox configuration to be more consistent and clearer.

- Moved travis to default to Python 3 for linting and tests.
- Fixed missing mock for cairo in sphinx config.
- Collated the base deps sections to improve readability.
- Added PYTEST_ADDOPTS env to override pytest verbosity in just tox
  tests as this was a common option being used.
- Renamed env 'testcoverage' to the more concise 'coverage' and moved
  html creation under single env as handy to have this output as well
  as report.
- Cleaned up the isort config for gtk3.
- Added `bad-continuation` to pylint config as conflcts with black
  formatting.
- Fix isort issue with bbfreeze script. This will likely be removed
  in future so just skip sorting it.
2018-11-02 08:47:57 +00:00
Calum Lind 98051bdea2 [Docs] Move apidoc command to Sphinx config
The apidoc modules were not being generated on ReadTheDocs because
there is no way to run sphinx-apidoc manually.

Moved the running of sphinx-apidoc into conf.py.

Added zope.interface minimum version to fix Readthedocs warning.
2018-11-02 00:21:50 +00:00
Calum Lind 20431cc771 [Docs] Fix build errors getting Deluge version
The use of pkg_resource.require caused an unwanted requirements lookup
that errored out the sphinx build when no dependencies are installed.

This is fixed by switching to pkg_resources.get_distribution.

Also changed the tox docs env to not install Deluge as the setup.py
now contains install_requires which is unwanted.
2018-11-01 23:18:05 +00:00
Calum Lind 82ecf8a416 [Docs] Reorganise and add sections from wiki
- Change the layout and contents of docs to be better organised and
  follow ideas from: https://www.divio.com/blog/documentation/
- Use markdown for non-technical documents to speed up writing.
- Added new sections and imported documents from Trac wiki.

Build fixes:

- Added a patch to fix recommonmark 0.4 and doc referencing:
    https://github.com/rtfd/recommonmark/issues/93
- Set docs build in tox to Py2.7 since there are problems with autodoc
  mocking multiple inheritance on Python 3 resulting in metaclass errors.
- Supressed warning about `modules.rst` not in the toctree by creating
  a static `modules.rst` with `:orphan:` file directive and add to git.
  Also skip creating this toc file with sphinx-apidoc in setup and tox.
- Simplified finding exported RPC and JSON API methods by adding an
  autodoc custom class directive. Removed unneeded __rpcapi.py.
2018-11-01 17:38:10 +00:00
Calum Lind 0b2cb7539f Cleanup Tox and CI configs
- Use the apt addon for installing libtorrent package.
- Start the py3 test sooner as it is slow to complete.
- Add if conditions for gtkui test dependencies.
- Remove Appveyor tests that are taken care of by Travis.
2018-10-10 18:50:41 +01:00
Calum Lind 6fdbf0ba5d Update tox and CI for Python 3 2018-10-10 17:57:02 +01:00
Calum Lind 39f37e6133 [Tests] Remove slimit dependency
The changes to the minify script mean we no longer require slimit.
2018-10-08 12:19:03 +01:00
Calum Lind 9e29fe4111 [Tests] Lint with pre-commit
- Add lint section to tox.
- Replace flake8 with lint on Travis and remove commented out sections.
- Remove flake8 from appveyor to reduce sequential testing time.
2018-10-05 18:45:37 +01:00
Calum Lind 6973f96f8c [Tests] Update tox and CI configs
- Add new requirements files to make it easier to install deps.

- Tox changes
  - Update tox to use new requirements files.
  - Tweak heading styles.
  - Add development environment command `devenv`.
  - Remove testenv command as it would run on devenv creation.

- Travis changes
  - Now uses xenial as trusty is very old now.
  - Trial run disabled to speed up tests.
  - Add tox-venv for Python 3 support.
  - Only install testssl if running security tests.

- Appveyor
  - Add tox-venv for Python 3 support.
  - Use requirements file for non-tox.
  - Remove trial run to speed up testing.
2018-10-05 13:23:45 +01:00
Calum Lind 36606fc448 [Docs] Add markdown support
- Use recommonmark to enable use of markdown files in docs.
- Fix theme not specified
- Remove unused spelling module.
- Cleanup mocking modules in conf so building docs requires only Sphinx.
- Simplify tox section, including use of requirements-docs file. Added
  slimit dependency for sdist-ing deluge package.
2018-10-04 15:53:42 +01:00
Calum Lind b1cdc32f73 [Lint] Use Black to auto-format code
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.
2018-10-03 15:21:53 +01:00
Calum Lind cc1807cf97 Fix travis docs failing with Sphinx 1.8.0
Sphinx pinned to 1.7

See sphinx-doc/sphinx#5417
2018-09-14 16:09:20 +01:00
Calum Lind 63b7f6d382 [Tests] Add pytest-twisted to tox deps 2018-09-14 16:06:06 +01:00
DjLegolas b9a9e06c1d [WebUI][Daemon] Enhance TLS Security
This applies the following for both WebUI and Daemon:
1. Raised minimal TLS version to TLSv1.2
2. Added specific cipher suite list
3. Added support for ECDSA auth keys
4. Added support for ECDHE key exchange algorithm

We disabled the ability to perform TLS/SSL renegotiation and therefore
will prevent the clients from renegotiating, which can be exploit for
DoS attacks.

New security tests now will be skipped when running `pydef` and `trial`
testenvs. To run the test, use the testenv `security` or add the environment
variable `SECURITY_TESTS` before running the tests. Also should only run when
adding to the commit message the string `SECURITY_TEST`.
2018-09-06 19:14:13 +01:00
Calum Lind 3fc97672de Fix the docs run failing on Travis
Likely that the deprecation warning from cryptography is causing the
setup.py sphinx build command to return an error so the tox/travis job
is marked as failing. Changing to calling the sphinx-build command
directly solves this.

Also updated the sphinx config for built-in napoleon and faster builds
using jobs option.
2018-07-28 10:26:02 +01:00
Unknown edd431a304 Make Tox Multi-OS Friendly 2018-06-02 11:29:51 +01:00
Calum Lind d642fa3989 Fix files to pass new Flake8 checkers
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.
2018-06-01 23:41:17 +01:00
Calum Lind 8439698336 [Tox] Use platform independant toxworkdir instead of PWD
The use of `{env:PWD}` is not available on Windows so switch to
`{toxworkdir}` which is the directory where virtual environments
are created and sub directories for packaging reside.
2018-05-20 08:46:40 +01:00
Calum Lind 4982ba0b98 Cleanup pytest config in tox
Config values are either wrong, unused or default is better.

Disable logging of deluge log output in testing.

Newer versions of pytest now use `pytest` cmd so rename.
2017-12-17 11:55:09 +00:00
Calum Lind 4e79ed8124 Fix tox config to install latest pip packages
Trial changed command in latest versions of twisted
2017-12-16 17:39:48 +00:00
Calum Lind c72459d3ef Replace pep8 with pycodestyle in tox.ini 2017-06-07 11:08:50 +01:00
Calum Lind 5c1faf3d5e [Tests] Unpin isort as 4.2.13 contains fixes 2017-06-07 10:31:09 +01:00
Calum Lind ede0f710f8 [Core] Replace usage of deprecated new.classobj
* type is new module to use
2017-06-05 09:03:34 +01:00
Calum Lind 66718f6d8e [Docs] Remove chardet mock to fix requests version check
* chardet is an easily installed pure python module so doesn't need mocking.
2017-06-05 08:10:13 +01:00
Calum Lind 78dc75d55d [Tests] Specify module versions to fix tox tests 2017-06-05 00:01:07 +01:00
Calum Lind 4a274466ac Add python 3 section to tox 2017-03-16 23:20:56 +00:00
Calum Lind df4d97c447 [Tox] Twisted version pin to 16.6
* There is a problem with Twisted 17 and the setup for travis and tox
   using site-packages with an old openssh package.

       AttributeError: 'module' object has no attribute 'OP_NO_TLSv1_1'

 * The simplest workaround for now is to pin Twisted to 16.6.
2017-02-14 18:59:34 +00:00
Calum Lind b71a2fa549 [Tox] Remove py26 and add lt version output to trial 2017-01-26 12:49:55 +00:00
Calum Lind 7468078b71 [Setup] Add a CleanDocs class 2016-11-28 12:58:34 +00:00
Calum Lind 874249655d [Tests] Replace isort test with flake8-isort
* Move the known_third_party back to setup.cfg with comments.
2016-11-25 12:43:50 +00:00
bendikro 0edebda1c7 [WebUI] Log correct http address if listening on IPv6 2016-11-22 22:07:03 +00:00
Calum Lind af6b277d28 [Lint] Add flake8-quotes to tox and fix bad quotes 2016-11-04 00:10:23 +00:00
bendikro 54685226c4 [Tests] Remove redundant pillow dep from tox 2016-11-03 10:45:01 +00:00
bendikro 61b059f015 [Lint] Fix couple of pylint complaints 2016-11-03 10:45:01 +00:00
Calum Lind 5c7a4549f7 [Tests] Add pillow dep so pylint parses Win32IconImagePlugin 2016-11-03 10:45:00 +00:00
bendikro 2f4cb0156c [Tests] Fix for isort config package handling
* Force gtk modules to be third_party for tox/travis testing.
2016-11-01 14:04:14 +00:00