diff --git a/conftest.py b/conftest.py index c99115ba..044963bb 100644 --- a/conftest.py +++ b/conftest.py @@ -1,7 +1 @@ -import six -collect_ignore = [] - -if six.PY3: - for fn in open('tests/py3-ignores.txt'): - if fn.strip(): - collect_ignore.append(fn.strip()) +collect_ignore = ["setup.py"] diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 00000000..515b2196 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +doctest_optionflags = ALLOW_UNICODE ALLOW_BYTES diff --git a/tox.ini b/tox.ini index 5fb4f780..696f1b2e 100644 --- a/tox.ini +++ b/tox.ini @@ -11,4 +11,7 @@ deps = pytest pytest-cov commands = - py.test --cov=w3lib --cov-report= {posargs:w3lib tests} + py.test \ + --doctest-modules \ + --cov=w3lib --cov-report=term \ + {posargs:w3lib tests} diff --git a/w3lib/encoding.py b/w3lib/encoding.py index b7370367..ac44efe5 100644 --- a/w3lib/encoding.py +++ b/w3lib/encoding.py @@ -230,7 +230,7 @@ def html_to_unicode(content_type_header, html_body_str, >>> import w3lib.encoding >>> w3lib.encoding.html_to_unicode(None, - ... """ + ... b""" ...
... ... diff --git a/w3lib/url.py b/w3lib/url.py index 28c59ab3..900b360b 100644 --- a/w3lib/url.py +++ b/w3lib/url.py @@ -35,6 +35,7 @@ def urljoin_rfc(base, ref, encoding='utf-8'): .. warning:: This function is deprecated and will be removed in future. + It is not supported with Python 3. Please use ``urlparse.urljoin`` instead. Same as urlparse.urljoin but supports unicode values in base and ref @@ -48,7 +49,8 @@ def urljoin_rfc(base, ref, encoding='utf-8'): 'http://www.example.com/otherpath/index2.html' >>> - >>> w3lib.url.urljoin_rfc('http://www.example.com/path/index.html', u'fran\u00e7ais/d\u00e9part.htm') + >>> # Note: the following does not work in Python 3 + >>> w3lib.url.urljoin_rfc(b'http://www.example.com/path/index.html', u'fran\u00e7ais/d\u00e9part.htm') # doctest: +SKIP 'http://www.example.com/path/fran\xc3\xa7ais/d\xc3\xa9part.htm' >>>