Closed kloczek closed 1 year ago
tox based test suite is warnings:
py38-base create: /home/tkloczko/rpmbuild/BUILD/html5lib-1.1/.tox/py38-base
py38-base installdeps: -r/home/tkloczko/rpmbuild/BUILD/html5lib-1.1/requirements-test.txt
py38-base inst: /home/tkloczko/rpmbuild/BUILD/html5lib-1.1/.tox/.tmp/package/1/html5lib-1.1.zip
py38-base installed: appdirs==1.4.4,attrs==20.3.0,coverage==5.3.1,distlib==0.3.1,filelock==3.0.12,flake8==3.8.4,html5lib==1.1,mccabe==0.6.1,mock==4.0.3,more-itertools==8.6.0,packaging==20.8,pluggy==0.13.1,py==1.10.0,pycodestyle==2.6.0,pyflakes==2.2.0,pyparsing==2.4.7,pytest==5.4.3,pytest-expect==1.1.0,six==1.15.0,toml==0.10.2,tox==3.21.1,u-msgpack-python==2.7.1,virtualenv==20.3.1,wcwidth==0.2.5,webencodings==0.5.1
py38-base run-test-pre: PYTHONHASHSEED='3307129851'
py38-base run-test: commands[0] | /home/tkloczko/rpmbuild/BUILD/html5lib-1.1/.tox/py38-base/bin/py.test
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.3, pytest-5.4.3, py-1.10.0, pluggy-0.13.1
cachedir: .tox/py38-base/.pytest_cache
rootdir: /home/tkloczko/rpmbuild/BUILD/html5lib-1.1, inifile: pytest.ini
plugins: expect-1.1.0
collected 33439 items
[..]
============================================================================= warnings summary =============================================================================
html5lib/tests/conftest.py:105: 14 tests with warnings
/home/tkloczko/rpmbuild/BUILD/html5lib-1.1/html5lib/tests/conftest.py:105: PytestDeprecationWarning: direct construction of TokenizerFile has been deprecated, please use TokenizerFile.from_parent
return TokenizerFile(path, parent)
html5lib/tests/conftest.py:102: 56 tests with warnings
/home/tkloczko/rpmbuild/BUILD/html5lib-1.1/html5lib/tests/conftest.py:102: PytestDeprecationWarning: direct construction of TreeConstructionFile has been deprecated, please use TreeConstructionFile.from_parent
return TreeConstructionFile(path, parent)
html5lib/filters/sanitizer.py:29
/home/tkloczko/rpmbuild/BUILD/html5lib-1.1/html5lib/filters/sanitizer.py:29: DeprecationWarning: html5lib's sanitizer is deprecated; see https://github.com/html5lib/html5lib-python/issues/443 and please let us know if Bleach is unsuitable for your needs
warnings.warn(_deprecation_msg, DeprecationWarning)
html5lib/tests/tokenizer.py:195: 6804 tests with warnings
/home/tkloczko/rpmbuild/BUILD/html5lib-1.1/html5lib/tests/tokenizer.py:195: PytestDeprecationWarning: direct construction of TokenizerTestCollector has been deprecated, please use TokenizerTestCollector.from_parent
yield TokenizerTestCollector(str(i), self, testdata=test)
html5lib/tests/tokenizer.py:210: 7030 tests with warnings
/home/tkloczko/rpmbuild/BUILD/html5lib-1.1/html5lib/tests/tokenizer.py:210: PytestDeprecationWarning: direct construction of TokenizerTest has been deprecated, please use TokenizerTest.from_parent
item = TokenizerTest(initialState,
html5lib/tests/tree_construction.py:29: 1704 tests with warnings
/home/tkloczko/rpmbuild/BUILD/html5lib-1.1/html5lib/tests/tree_construction.py:29: PytestDeprecationWarning: direct construction of TreeConstructionTest has been deprecated, please use TreeConstructionTest.from_parent
yield TreeConstructionTest(str(i), self, testdata=test)
html5lib/tests/tree_construction.py:51: 17040 tests with warnings
/home/tkloczko/rpmbuild/BUILD/html5lib-1.1/html5lib/tests/tree_construction.py:51: PytestDeprecationWarning: direct construction of ParserTest has been deprecated, please use ParserTest.from_parent
item = ParserTest(nodeid,
html5lib/tests/tree_construction.py:64: 8520 tests with warnings
/home/tkloczko/rpmbuild/BUILD/html5lib-1.1/html5lib/tests/tree_construction.py:64: PytestDeprecationWarning: direct construction of TreeWalkerTest has been deprecated, please use TreeWalkerTest.from_parent
item = TreeWalkerTest(nodeid,
-- Docs: https://docs.pytest.org/en/latest/warnings.html
==================================================== 17081 passed, 15689 skipped, 669 xfailed, 41169 warnings in 43.54s ====================================================
This may be a duplicate of #505 (support for pytest
v6), and if so should be resolved by pull request #506 (pending an updated release of html5lib
).
FYI I'm usimg pytest 6.2.1.
Just tested that patch. Still I see some warnings:
.tox/py38-six19/lib/python3.8/site-packages/_pytest/config/__init__.py:1183
/home/tkloczko/rpmbuild/BUILD/html5lib-1.1/.tox/py38-six19/lib/python3.8/site-packages/_pytest/config/__init__.py:1183: PytestDeprecationWarning: The --strict option is deprecated, use --strict-markers instead.
self.issue_config_time_warning(
html5lib/filters/sanitizer.py:29
/home/tkloczko/rpmbuild/BUILD/html5lib-1.1/html5lib/filters/sanitizer.py:29: DeprecationWarning: html5lib's sanitizer is deprecated; see https://github.com/html5lib/html5lib-python/issues/443 and please let us know if Bleach is unsuitable for your needs
warnings.warn(_deprecation_msg, DeprecationWarning)
I can confirm that with https://github.com/html5lib/html5lib-python/issues/505 pytest is now happy :)
BTW which one method fo uou recommend of the test suite execution? straight pytest or over tox?
Just tested that patch. Still I see some warnings:
.tox/py38-six19/lib/python3.8/site-packages/_pytest/config/__init__.py:1183 /home/tkloczko/rpmbuild/BUILD/html5lib-1.1/.tox/py38-six19/lib/python3.8/site-packages/_pytest/config/__init__.py:1183: PytestDeprecationWarning: The --strict option is deprecated, use --strict-markers instead. self.issue_config_time_warning( html5lib/filters/sanitizer.py:29 /home/tkloczko/rpmbuild/BUILD/html5lib-1.1/html5lib/filters/sanitizer.py:29: DeprecationWarning: html5lib's sanitizer is deprecated; see https://github.com/html5lib/html5lib-python/issues/443 and please let us know if Bleach is unsuitable for your needs warnings.warn(_deprecation_msg, DeprecationWarning)
This looks like an advisory message, as far as I can tell - reading up on the issue it links to (and adding any feedback you have) could be useful if & when you have time.
I can confirm that with #505 pytest is now happy :)
Glad to hear that!
BTW which one method fo uou recommend of the test suite execution? straight pytest or over tox?
It depends on what you're trying to do, I think. The current guidance seems to recommend pytest
if you're running against a single version of Python, or tox
as more appropriate if you want to check multi-version Python compatibility.
It depends on what you're trying to do, I think. The current guidance seems to recommend
pytest
if you're running against a single version of Python, ortox
as more appropriate if you want to check multi-version Python compatibility.
I'm building rpm package fo exct version .. so pytest should be enough.
BTW in my build prcedure I've switched to VCV tagged tarball because git tree contains sphinx documentation. However after that I see more pytest issues.
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-html5lib-1.1-7.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-html5lib-1.1-7.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
Using --randomly-seed=2620825975
rootdir: /home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1, configfile: pytest.ini
plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, aspectlib-1.5.2, toolbox-0.5, rerunfailures-9.1.1, requests-mock-1.9.3, cov-2.12.1, pyfakefs-4.5.0, flaky-3.7.0, benchmark-3.4.1, xdist-2.3.0, pylama-7.7.1, datadir-1.3.1, regressions-2.2.0, cases-3.6.3, xprocess-0.18.1, black-0.3.12, anyio-3.3.0, asyncio-0.15.1, trio-0.7.0, subtests-0.5.0, isort-2.0.0, hypothesis-6.14.6, mock-3.6.1, profiling-1.7.0, randomly-3.8.0, Faker-8.12.1, nose2pytest-1.0.8
collected 992 items
html5lib/tests/test_optionaltags_filter.py . [ 0%]
html5lib/tests/test_tokenizer2.py ... [ 0%]
html5lib/tests/test_meta.py . [ 0%]
html5lib/tests/test_alphabeticalattributes.py ..... [ 1%]
html5lib/tests/test_serializer.py .................................................................................................................................. [ 14%]
.................................................................................................................................................................... [ 30%]
................................ [ 33%]
html5lib/tests/test_parser2.py .......... [ 34%]
html5lib/tests/test_treewalkers.py ..s......s.s.s...s.sss.s.s..ss.. [ 38%]
html5lib/tests/test_whitespace_filter.py ........... [ 39%]
html5lib/tests/test_treeadapters.py . [ 39%]
html5lib/tests/sanitizer-testdata/tests1.dat ........................................................................ [ 46%]
html5lib/tests/test_sanitizer.py ................................................................................................................................... [ 59%]
.................................................................................................................................................................... [ 76%]
.......................................................................................................... [ 86%]
html5lib/tests/test_stream.py .................................................................................................. [ 96%]
html5lib/tests/test_encoding.py .........s..............F.s.... [100%]
================================================================================= FAILURES =================================================================================
_______________________________________________________________________________ test_chardet _______________________________________________________________________________
def test_chardet():
> with open(os.path.join(test_dir, "encoding", "chardet", "test_big5.txt"), "rb") as fp:
E FileNotFoundError: [Errno 2] No such file or directory: '/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/html5lib/tests/testdata/encoding/chardet/test_big5.txt'
html5lib/tests/test_encoding.py:114: FileNotFoundError
============================================================================= warnings summary =============================================================================
../../../../../usr/lib/python3.8/site-packages/_pytest/config/__init__.py:1183
/usr/lib/python3.8/site-packages/_pytest/config/__init__.py:1183: PytestDeprecationWarning: The --strict option is deprecated, use --strict-markers instead.
self.issue_config_time_warning(
html5lib/filters/sanitizer.py:29
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/html5lib/filters/sanitizer.py:29: DeprecationWarning: html5lib's sanitizer is deprecated; see https://github.com/html5lib/html5lib-python/issues/443 and please let us know if Bleach is unsuitable for your needs
warnings.warn(_deprecation_msg, DeprecationWarning)
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================= short test summary info ==========================================================================
SKIPPED [4] html5lib/tests/test_treewalkers.py:175: dict order undef
SKIPPED [2] html5lib/tests/test_treewalkers.py:116: Treebuilder not loaded
SKIPPED [4] html5lib/tests/test_treewalkers.py:142: dict order undef
SKIPPED [2] html5lib/tests/test_treewalkers.py:95: Treebuilder not loaded
SKIPPED [1] html5lib/tests/test_encoding.py:85: got empty parameter set ['data', 'encoding'], function test_parser_encoding at /home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/html5lib/tests/test_encoding.py:84
SKIPPED [1] html5lib/tests/test_encoding.py:95: got empty parameter set ['data', 'encoding'], function test_prescan_encoding at /home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/html5lib/tests/test_encoding.py:94
FAILED html5lib/tests/test_encoding.py::test_chardet - FileNotFoundError: [Errno 2] No such file or directory: '/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/html5li...
========================================================== 1 failed, 977 passed, 14 skipped, 2 warnings in 3.16s ===========================================================
pytest-xprocess reminder::Be sure to terminate the started process by running 'pytest --xkill' if you have not explicitly done so in your fixture with 'xprocess.getinfo(<process_name>).terminate()'.
Looks like in giot repo is missing tests/testdata/encoding/chardet/test_big5.txt
file.
Q: where I can find it?
Also please have look on other pytaest warnings.
Please see PR https://github.com/html5lib/html5lib-python/pull/544.
Here is updated output with that PR:
[tkloczko@devel-g2v SPECS]$ rpmbuild -ba --rmsource python-html5lib.spec
warning: Downloading https://github.com/html5lib/html5lib-python//archive/1.1/python-html5lib-1.1.tar.gz to /home/tkloczko/rpmbuild/SOURCES/python-html5lib-1.1.tar.gz
warning: Downloading https://github.com/html5lib/html5lib-python//commit/569e580d.patch#/python-html5lib-Stop-running-coverage-on-Travis-AppVeyor.patch to /home/tkloczko/rpmbuild/SOURCES/python-html5lib-Stop-running-coverage-on-Travis-AppVeyor.patch
warning: Downloading https://github.com/html5lib/html5lib-python//commit/a7c18875.patch#/python-html5lib-changelog-the-1.1-version-has-been-released.patch to /home/tkloczko/rpmbuild/SOURCES/python-html5lib-changelog-the-1.1-version-has-been-released.patch
warning: Downloading https://github.com/html5lib/html5lib-python//commit/2c19b989.patch#/python-html5lib-Use-Node.from_parent-constructor-to-support-pytest-6.patch to /home/tkloczko/rpmbuild/SOURCES/python-html5lib-Use-Node.from_parent-constructor-to-support-pytest-6.patch
warning: Downloading https://github.com/html5lib/html5lib-python//commit/ad3bde76.patch#/python-html5lib-Update-html5lib-s-test-expectations.patch to /home/tkloczko/rpmbuild/SOURCES/python-html5lib-Update-html5lib-s-test-expectations.patch
warning: Downloading https://github.com/html5lib/html5lib-python//commit/2f25bf25.patch#/python-html5lib-Add-GitHub-Actions-workflow-for-tox-527.patch to /home/tkloczko/rpmbuild/SOURCES/python-html5lib-Add-GitHub-Actions-workflow-for-tox-527.patch
warning: Downloading https://github.com/html5lib/html5lib-python//commit/f7cab6f0.patch#/python-html5lib-Update-html5lib-s-test-expectations-2.patch to /home/tkloczko/rpmbuild/SOURCES/python-html5lib-Update-html5lib-s-test-expectations-2.patch
warning: Downloading https://github.com/html5lib/html5lib-python//pull/544.patch#/python-html5lib-Fix-pytest-warnings.patch to /home/tkloczko/rpmbuild/SOURCES/python-html5lib-Fix-pytest-warnings.patch
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.ThfAdT
+ umask 022
+ cd /home/tkloczko/rpmbuild/BUILD
+ cd /home/tkloczko/rpmbuild/BUILD
+ rm -rf html5lib-python-1.1
+ /usr/bin/gzip -dc /home/tkloczko/rpmbuild/SOURCES/python-html5lib-1.1.tar.gz
+ /usr/bin/tar -xof -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd html5lib-python-1.1
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ /usr/bin/cat /home/tkloczko/rpmbuild/SOURCES/python-html5lib-man3_level.patch
+ /usr/bin/patch -p1 -s --fuzz=0 --no-backup-if-mismatch -f
+ /usr/bin/cat /home/tkloczko/rpmbuild/SOURCES/python-html5lib-Stop-running-coverage-on-Travis-AppVeyor.patch
+ /usr/bin/patch -p1 -s --fuzz=0 --no-backup-if-mismatch -f
+ /usr/bin/cat /home/tkloczko/rpmbuild/SOURCES/python-html5lib-changelog-the-1.1-version-has-been-released.patch
+ /usr/bin/patch -p1 -s --fuzz=0 --no-backup-if-mismatch -f
+ /usr/bin/cat /home/tkloczko/rpmbuild/SOURCES/python-html5lib-Use-Node.from_parent-constructor-to-support-pytest-6.patch
+ /usr/bin/patch -p1 -s --fuzz=0 --no-backup-if-mismatch -f
+ /usr/bin/cat /home/tkloczko/rpmbuild/SOURCES/python-html5lib-Update-html5lib-s-test-expectations.patch
+ /usr/bin/patch -p1 -s --fuzz=0 --no-backup-if-mismatch -f
+ /usr/bin/cat /home/tkloczko/rpmbuild/SOURCES/python-html5lib-Add-GitHub-Actions-workflow-for-tox-527.patch
+ /usr/bin/patch -p1 -s --fuzz=0 --no-backup-if-mismatch -f
+ /usr/bin/cat /home/tkloczko/rpmbuild/SOURCES/python-html5lib-Update-html5lib-s-test-expectations-2.patch
+ /usr/bin/patch -p1 -s --fuzz=0 --no-backup-if-mismatch -f
+ /usr/bin/cat /home/tkloczko/rpmbuild/SOURCES/python-html5lib-Fix-pytest-warnings.patch
+ /usr/bin/patch -p1 -s --fuzz=0 --no-backup-if-mismatch -f
+ RPM_EC=0
++ jobs -p
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.PkPPyX
[..]
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-html5lib-1.1-9.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-html5lib-1.1-9.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra --deselect html5lib/tests/test_encoding.py::test_chardet
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1, configfile: pytest.ini
plugins: expect-1.1.0
collected 992 items / 1 deselected / 991 selected
html5lib/tests/test_alphabeticalattributes.py ..... [ 0%]
html5lib/tests/test_encoding.py ............................ss [ 3%]
html5lib/tests/test_meta.py . [ 3%]
html5lib/tests/test_optionaltags_filter.py . [ 3%]
html5lib/tests/test_parser2.py .......... [ 4%]
html5lib/tests/test_sanitizer.py ................................................................................................................................... [ 17%]
.................................................................................................................................................................... [ 34%]
.......................................................................................................... [ 45%]
html5lib/tests/test_serializer.py .................................................................................................................................. [ 58%]
.................................................................................................................................................................... [ 74%]
................................ [ 78%]
html5lib/tests/test_stream.py .................................................................................................. [ 87%]
html5lib/tests/test_tokenizer2.py ... [ 88%]
html5lib/tests/test_treeadapters.py . [ 88%]
html5lib/tests/test_treewalkers.py .....ss........ss.....ssss.ssss. [ 91%]
html5lib/tests/test_whitespace_filter.py ........... [ 92%]
html5lib/tests/sanitizer-testdata/tests1.dat ........................................................................ [100%]
============================================================================= warnings summary =============================================================================
../../../../../usr/lib/python3.8/site-packages/_pytest/nodes.py:140
/usr/lib/python3.8/site-packages/_pytest/nodes.py:140: PytestRemovedIn8Warning: The (fspath: py.path.local) argument to SanitizerFile is deprecated. Please use the (path: pathlib.Path) argument instead.
See https://docs.pytest.org/en/latest/deprecations.html#fspath-argument-for-node-constructors-replaced-with-pathlib-path
return super().__call__(*k, **kw)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================= short test summary info ==========================================================================
SKIPPED [1] html5lib/tests/test_encoding.py:85: got empty parameter set ['data', 'encoding'], function test_parser_encoding at /home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/html5lib/tests/test_encoding.py:84
SKIPPED [1] html5lib/tests/test_encoding.py:95: got empty parameter set ['data', 'encoding'], function test_prescan_encoding at /home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/html5lib/tests/test_encoding.py:94
SKIPPED [2] html5lib/tests/test_treewalkers.py:95: Treebuilder not loaded
SKIPPED [2] html5lib/tests/test_treewalkers.py:116: Treebuilder not loaded
SKIPPED [4] html5lib/tests/test_treewalkers.py:142: dict order undef
SKIPPED [4] html5lib/tests/test_treewalkers.py:175: dict order undef
========================================================= 977 passed, 14 skipped, 1 deselected, 1 warning in 1.97s =========================================================
The new warning:
PytestRemovedIn8Warning: The (fspath: py.path.local) argument to SanitizerFile is deprecated. Please use the (path: pathlib.Path) argument instead. See https://docs.pytest.org/en/latest/deprecations.html#fspath-argument-for-node-constructors-replaced-with-pathlib-path
You're getting that because you're testing with pytest 7, but this project doesn't support testing pytest 7. requirements-test.txt
has:
pytest>=4.6.10,<5 ; python_version < '3'
pytest>=5.4.2,<7 ; python_version >= '3'
The fix is to use the new pytest_collect_file
added in pytest 7. Compare:
Something like:
diff --git a/html5lib/tests/conftest.py b/html5lib/tests/conftest.py
index fffeb50..43020e6 100644
--- a/html5lib/tests/conftest.py
+++ b/html5lib/tests/conftest.py
@@ -90,7 +90,7 @@ def pytest_configure(config):
pytest.exit("\n".join(msgs))
-def pytest_collect_file(path, parent):
+def pytest_collect_file(file_path, path, parent):
dir = os.path.abspath(path.dirname)
dir_and_parents = set()
while dir not in dir_and_parents:
@@ -99,13 +99,13 @@ def pytest_collect_file(path, parent):
if _tree_construction in dir_and_parents:
if path.ext == ".dat":
- return TreeConstructionFile.from_parent(parent, fspath=path)
+ return TreeConstructionFile.from_parent(parent, path=file_path)
elif _tokenizer in dir_and_parents:
if path.ext == ".test":
- return TokenizerFile.from_parent(parent, fspath=path)
+ return TokenizerFile.from_parent(parent, path=file_path)
elif _sanitizer_testdata in dir_and_parents:
if path.ext == ".dat":
- return SanitizerFile.from_parent(parent, fspath=path)
+ return SanitizerFile.from_parent(parent, path=file_path)
# Tiny wrapper to allow .from_parent constructors on older pytest for PY27
diff --git a/requirements-test.txt b/requirements-test.txt
index 57f8f61..e09840e 100644
--- a/requirements-test.txt
+++ b/requirements-test.txt
@@ -3,7 +3,7 @@
tox>=3.15.1,<4
flake8>=3.8.1,<3.9
pytest>=4.6.10,<5 ; python_version < '3'
-pytest>=5.4.2,<7 ; python_version >= '3'
+pytest>=7,<8 ; python_version >= '3'
coverage>=5.1,<6
pytest-expect>=1.1.0,<2
mock>=3.0.5,<4 ; python_version < '3.6'
But that of course requires pytest>=7
which is going to break for Python 2.7 because pytest 4.6 is the last to support 2.7:
https://docs.pytest.org/en/7.1.x/py27-py34-deprecation.html
I propose dropping EOL Python 2.7 instead: https://github.com/html5lib/html5lib-python/pull/536
This new deprecation warning is now fixed in 589b01c61f706c4e9c69337692b8d1d4679288b5 in PR https://github.com/html5lib/html5lib-python/pull/536.