modernize, drop old python, upgrade lxml - #24
Conversation
There was a problem hiding this comment.
Pull request overview
This PR modernizes the project by dropping legacy Python/nose-era tooling, migrating test execution to pytest, upgrading core dependencies (notably lxml), and moving CI from Travis/tox to GitHub Actions.
Changes:
- Replace nose-based testing/coverage with pytest + pytest-cov and update tests accordingly.
- Remove Python 3.7-era compatibility (e.g.,
sixusage) and setpython_requires=">=3.8". - Replace Travis/tox/pylint configuration with a GitHub Actions CI workflow and a standalone
.flake8.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tox.ini | Removed legacy tox configuration. |
| setup.py | Simplified setuptools import, added python_requires>=3.8, updated classifiers. |
| run_tests.sh | Switched test runner from nosetests to pytest and kept flake8 linting. |
| requirements/testing.txt | Replaced nose/coverage with pytest/pytest-cov. |
| requirements/default.txt | Updated html5lib/lxml requirements and removed six. |
| pylintrc | Removed legacy pylint configuration. |
| pylint.sh | Removed legacy pylint runner script. |
| htmltreediff/util.py | Removed six usage; simplified string conversion. |
| htmltreediff/text.py | Removed six usage; adjusted docstring and regex compilation typing check. |
| htmltreediff/tests.py | Updated assertions as part of migrating away from nose tools. |
| htmltreediff/test_xml.py | Replaced nose assertions with plain assert. |
| htmltreediff/test_text.py | Converted generator-style tests to pytest parametrization. |
| htmltreediff/test_html.py | Converted generator-style tests to pytest parametrization and plain asserts. |
| htmltreediff/test_diff_core.py | Replaced nose assertions with plain assert patterns. |
| htmltreediff/test_cli.py | Removed six.StringIO and nose assertions; used stdlib io.StringIO. |
| htmltreediff/diff_core.py | Removed six and updated string type checks. |
| .travis.yml | Removed Travis CI configuration. |
| .github/workflows/ci.yml | Added GitHub Actions CI for tests across 3.8–3.12 and linting on 3.12. |
| .flake8 | Added flake8 configuration previously embedded in tox config. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
mostly copied from htmltreediff/test_text.py that shows up as deleted, with some changes/refactor to change from nose-style generated tests to pytest parametrize
| ) | ||
|
|
||
|
|
||
| def assert_html_equal(a_html, b_html): |
There was a problem hiding this comment.
copied from test_core
| yield case | ||
|
|
||
|
|
||
| def test_node_compare(): |
There was a problem hiding this comment.
moved to test_test_util
There was a problem hiding this comment.
This is not actually a new file. It's moved from htmltreediff/test_html.py, but then has a lot of refactors/changes for a few reasons: dropping old python, and switching from nose test generations to pytest's parametrize
A duplicate test case removed (LI changes markup internalization fix not done if next tag is not an insert)
Other than that, the tests remain functionally the same as before
| @@ -1,3 +1 @@ | |||
| html5lib==0.90 | |||
There was a problem hiding this comment.
html5lib was effectively dropped in #1, but the requirement was not removed from this file.
… GitHub Actions is slow and has missing dependencies, so we use a prebuilt wheel
| @@ -1,3 +1 @@ | |||
| html5lib==0.90 | |||
| lxml==4.2.5 | |||
| six==1.15.0 | |||
There was a problem hiding this comment.
No longer supporting py2 so six is not needed
| @@ -0,0 +1,3 @@ | |||
| [flake8] | |||
There was a problem hiding this comment.
im curious if you consideered going to pyproject.toml?
i know it adds an extra dependency for flake8 to have it read pyproject.toml ...
There was a problem hiding this comment.
that's why, because it can't read pyproject natively
|
|
||
| def multi_split(text, regexes): | ||
| """ | ||
| r""" |
There was a problem hiding this comment.
im curious why the r for this comment.
There was a problem hiding this comment.
raw string so \w is handled correctly
| ) | ||
| test.description = 'test_html_patch - %s' % case.name | ||
| yield test | ||
| @pytest.mark.parametrize('case', list(parse_cases(all_test_cases)), ids=lambda c: c.name) |
There was a problem hiding this comment.
This is cool - I've never used mark.parametrize
There was a problem hiding this comment.
parameterize is literally the best part of pytest. I love it.
| @@ -1,3 +0,0 @@ | |||
| #! /bin/sh | |||
There was a problem hiding this comment.
You should update the README.md file 'cause it talks about using this
AB#416857