Skip to content

Commit 140c4c6

Browse files
authored
Merge branch 'master' into pylint
2 parents 4e9222a + 4909d56 commit 140c4c6

File tree

10 files changed

+58
-19
lines changed

10 files changed

+58
-19
lines changed

.travis.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@ matrix:
44
include:
55
- python: 3.8
66
env: TOXENV=security
7+
- python: 3.8
8+
env: TOXENV=flake8
79
- python: 3.8
810
env: TOXENV=pylint
911
- python: 2.7
1012
env: TOXENV=py27
1113
- python: pypy
1214
env: TOXENV=pypy
13-
- python: 3.4
14-
env: TOXENV=py34
1515
- python: 3.5
1616
env: TOXENV=py35
1717
- python: 3.6
1818
env: TOXENV=py36
1919
- python: 3.7
2020
env: TOXENV=py37
21+
- python: 3.8
22+
env: TOXENV=py38
2123
- python: pypy3
2224
env: TOXENV=pypy3
2325
- python: 3.7
@@ -51,7 +53,7 @@ deploy:
5153
tags: true
5254
all_branches: true
5355
repo: scrapy/w3lib
54-
condition: "$TOXENV == py27"
56+
condition: "$TOXENV == py37"
5557

5658
cache:
5759
directories:

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ This is a Python library of web-related functions, such as:
2727
Requirements
2828
============
2929

30-
Python 2.7 or Python 3.4+
30+
Python 2.7 or Python 3.5+
3131

3232
Install
3333
=======

conftest.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
11
collect_ignore = ["setup.py"]
2+
3+
4+
def pytest_collection_modifyitems(session, config, items):
5+
# Avoid executing tests when executing `--flake8` flag (pytest-flake8)
6+
try:
7+
from pytest_flake8 import Flake8Item
8+
if config.getoption('--flake8'):
9+
items[:] = [item for item in items if isinstance(item, Flake8Item)]
10+
except ImportError:
11+
pass

docs/conf.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
# Add any Sphinx extension module names here, as strings. They can be extensions
2727
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
2828
extensions = [
29+
'hoverxref.extension',
2930
'notfound.extension',
3031
'sphinx.ext.autodoc',
3132
'sphinx.ext.doctest',
@@ -250,11 +251,18 @@
250251

251252
# Example configuration for intersphinx: refer to the Python standard library.
252253
intersphinx_mapping = {
253-
'python': ('http://docs.python.org/3', None),
254+
'pytest': ('https://docs.pytest.org/en/latest', None),
255+
'python': ('https://docs.python.org/3', None),
256+
'scrapy': ('https://scrapy.readthedocs.io/en/latest', None),
254257
'tox': ('https://tox.readthedocs.io/en/latest', None),
255258
}
256259

257260

258-
# --- Nitpicking options ------------------------------------------------------
261+
# -- Nitpicking options -------------------------------------------------------
259262

260263
nitpicky = True
264+
265+
266+
# -- sphinx-hoverxref options -------------------------------------------------
267+
268+
hoverxref_auto_ref = True

docs/index.rst

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,15 @@ Install
3939
Tests
4040
=====
4141

42-
`pytest`_ is the preferred way to run tests. Just run: ``pytest`` from the
43-
root directory to execute tests using the default Python interpreter.
42+
:doc:`pytest <pytest:index>` is the preferred way to run tests. Just run:
43+
``pytest`` from the root directory to execute tests using the default Python
44+
interpreter.
4445

4546
:doc:`tox <tox:index>` could be used to run tests for all supported Python
4647
versions. Install it (using 'pip install tox') and then run ``tox`` from
4748
the root directory - tests will be executed for all available
4849
Python interpreters.
4950

50-
.. _pytest: https://docs.pytest.org/en/latest/
51-
5251

5352
Changelog
5453
=========
@@ -59,12 +58,10 @@ Changelog
5958
History
6059
-------
6160

62-
The code of w3lib was originally part of the `Scrapy framework`_ but was later
63-
stripped out of Scrapy, with the aim of make it more reusable and to provide a
64-
useful library of web functions without depending on Scrapy.
65-
66-
.. _Scrapy framework: http://scrapy.org
67-
.. _NEWS file: https://github.com/scrapy/w3lib/blob/master/NEWS
61+
The code of w3lib was originally part of the :doc:`Scrapy framework
62+
<scrapy:index>` but was later stripped out of Scrapy, with the aim of make it
63+
more reusable and to provide a useful library of web functions without
64+
depending on Scrapy.
6865

6966

7067
Indices and tables

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
sphinx
2+
sphinx-hoverxref
23
sphinx-notfound-page
34
sphinx_rtd_theme

pytest.ini

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,15 @@
11
[pytest]
22
doctest_optionflags = ALLOW_UNICODE ALLOW_BYTES
3+
flake8-ignore =
4+
docs/conf.py E121 E122 E265 E401 E501
5+
tests/test_encoding.py E128 E221 E241 E302 E401 E501 E731
6+
tests/test_form.py E265 E501
7+
tests/test_html.py E123 E128 E241 E303 E501 E502
8+
tests/test_http.py E128 E261 E302 W291
9+
tests/test_url.py E126 E127 E128 E226 E261 E303 E501 W293 W391
10+
w3lib/encoding.py E126 E128 E302 E305 E401 E501
11+
w3lib/form.py E402 E501 E721
12+
w3lib/html.py E128 E302 E501 E502 W504
13+
w3lib/http.py E501
14+
w3lib/url.py E128 E261 E302 E305 E501 F841 W291 W293 W504
15+
w3lib/util.py E302

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
'Programming Language :: Python :: 2',
2222
'Programming Language :: Python :: 2.7',
2323
'Programming Language :: Python :: 3',
24-
'Programming Language :: Python :: 3.4',
2524
'Programming Language :: Python :: 3.5',
2625
'Programming Language :: Python :: 3.6',
2726
'Programming Language :: Python :: 3.7',
27+
'Programming Language :: Python :: 3.8',
2828
'Programming Language :: Python :: Implementation :: CPython',
2929
'Programming Language :: Python :: Implementation :: PyPy',
3030
'Topic :: Internet :: WWW/HTTP',

tests/test_html.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def test_with_escape_chars(self):
211211
# text with escape chars
212212
self.assertEqual(replace_escape_chars(u'escape\n\n'), u'escape')
213213
self.assertEqual(replace_escape_chars(u'escape\n', which_ones=('\t',)), u'escape\n')
214-
self.assertEqual(replace_escape_chars(u'escape\tchars\n', which_ones=('\t')), 'escapechars\n')
214+
self.assertEqual(replace_escape_chars(u'escape\tchars\n', which_ones=('\t',)), 'escapechars\n')
215215
self.assertEqual(replace_escape_chars(u'escape\tchars\n', replace_by=' '), 'escape chars ')
216216
self.assertEqual(replace_escape_chars(u'escape\tchars\n', replace_by=u'\xa3'), u'escape\xa3chars\xa3')
217217
self.assertEqual(replace_escape_chars(u'escape\tchars\n', replace_by=b'\xc2\xa3'), u'escape\xa3chars\xa3')

tox.ini

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# and then run "tox" from this directory.
55

66
[tox]
7-
envlist = py27, pypy, py34, py35, py36, py37, pypy3, docs
7+
envlist = py27, pypy, py35, py36, py37, py38, pypy3, docs
88

99
[testenv]
1010
deps =
@@ -22,6 +22,14 @@ deps =
2222
commands =
2323
bandit -r -c .bandit.yml {posargs:w3lib}
2424

25+
[testenv:flake8]
26+
basepython = python3
27+
deps =
28+
{[testenv]deps}
29+
pytest-flake8
30+
commands =
31+
pytest --flake8
32+
2533
[testenv:pylint]
2634
deps =
2735
{[testenv]deps}

0 commit comments

Comments
 (0)