Skip to content

modernize, drop old python, upgrade lxml - #24

Merged
kylegibson-rldatix merged 39 commits into
masterfrom
issue_24
Jun 30, 2026
Merged

modernize, drop old python, upgrade lxml#24
kylegibson-rldatix merged 39 commits into
masterfrom
issue_24

Conversation

@kylegibson-rldatix

@kylegibson-rldatix kylegibson-rldatix commented Jun 29, 2026

Copy link
Copy Markdown

AB#416857

  • Most of the changes are converting from nose tests to pytests: assert_equal to assert, and test generation (yield) to parameterize

@kylegibson-rldatix kylegibson-rldatix self-assigned this Jun 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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., six usage) and set python_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.

Comment thread requirements/testing.txt
Comment thread htmltreediff/tests.py
Comment thread htmltreediff/tests.py Outdated
Comment thread run_tests.sh Outdated
Comment thread run_tests.sh Outdated
Comment thread requirements/default.txt Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 6 comments.

Comment thread htmltreediff/test_text.py Outdated
Comment thread htmltreediff/test_html.py Outdated
Comment thread htmltreediff/test_html.py Outdated
Comment thread htmltreediff/test_html.py Outdated
Comment thread htmltreediff/test_html.py Outdated
Comment thread htmltreediff/test_html.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.

Comment thread htmltreediff/test_html.py Outdated

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 25 changed files in this pull request and generated 2 comments.

Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml
)


def assert_html_equal(a_html, b_html):

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copied from test_core

yield case


def test_node_compare():

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to test_test_util

@kylegibson-rldatix kylegibson-rldatix Jun 30, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread requirements/default.txt
@@ -1,3 +1 @@
html5lib==0.90

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

html5lib was effectively dropped in #1, but the requirement was not removed from this file.

Comment thread requirements/default.txt
@@ -1,3 +1 @@
html5lib==0.90
lxml==4.2.5
six==1.15.0

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer supporting py2 so six is not needed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 27 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#27 will drop support for 4.2.5

Comment thread .flake8
@@ -0,0 +1,3 @@
[flake8]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im curious if you consideered going to pyproject.toml?

i know it adds an extra dependency for flake8 to have it read pyproject.toml ...

@kylegibson-rldatix kylegibson-rldatix Jun 30, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's why, because it can't read pyproject natively

Comment thread htmltreediff/text.py

def multi_split(text, regexes):
"""
r"""

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im curious why the r for this comment.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cool - I've never used mark.parametrize

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parameterize is literally the best part of pytest. I love it.

Comment thread run_tests.sh
@@ -1,3 +0,0 @@
#! /bin/sh

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should update the README.md file 'cause it talks about using this

@jenblake-rldatix jenblake-rldatix left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good

@kylegibson-rldatix
kylegibson-rldatix merged commit bb9e97d into master Jun 30, 2026
15 checks passed
@kylegibson-rldatix
kylegibson-rldatix deleted the issue_24 branch June 30, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants