Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run test_htmlparser with unbuffered source #64822

Open
ezio-melotti opened this issue Feb 14, 2014 · 1 comment
Open

Run test_htmlparser with unbuffered source #64822

ezio-melotti opened this issue Feb 14, 2014 · 1 comment
Assignees
Labels
3.8 only security fixes tests Tests in the Lib/test dir type-feature A feature request or enhancement

Comments

@ezio-melotti
Copy link
Member

BPO 20623
Nosy @ezio-melotti, @bitdancer
Dependencies
  • bpo-15114: Deprecate strict mode of HTMLParser
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/ezio-melotti'
    closed_at = None
    created_at = <Date 2014-02-14.05:28:56.016>
    labels = ['3.8', 'type-feature', 'tests']
    title = 'Run test_htmlparser with unbuffered source'
    updated_at = <Date 2018-12-12.08:30:43.544>
    user = 'https://github.com/ezio-melotti'

    bugs.python.org fields:

    activity = <Date 2018-12-12.08:30:43.544>
    actor = 'serhiy.storchaka'
    assignee = 'ezio.melotti'
    closed = False
    closed_date = None
    closer = None
    components = ['Tests']
    creation = <Date 2014-02-14.05:28:56.016>
    creator = 'ezio.melotti'
    dependencies = ['15114']
    files = []
    hgrepos = []
    issue_num = 20623
    keywords = []
    message_count = 1.0
    messages = ['211201']
    nosy_count = 2.0
    nosy_names = ['ezio.melotti', 'r.david.murray']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'needs patch'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue20623'
    versions = ['Python 3.8']

    @ezio-melotti
    Copy link
    Member Author

    Currently test_htmlparser feeds the HTML source to the parser one char at the time (except a couple of buffering-specific tests that feed the parser with chunks of text). This ensures that the parser doesn't break when the source is fed in smaller chunks (that might end in the middle of a tag). However bpo-20288 revealed a bug that doesn't happen while feeding the parser char by char.

    In order to avoid similar problems, all the tests should feed the source to the parser both char by char and as a single string.
    So my plan is:

    1. wait until bpo-15114 is resolved and the strict mode and the strict tests are removed;
    2. either change TestCaseBase._run_check() to run every test twice (possibly by using subTest), or use a subclass-based approach with a different _run_check in the two subclasses.

    A few notes about this:

    • a third kind of test that feeds the parser with chunk of arbitrary length (e.g. 5 chars) could be added as well;
    • the increase in run-time shouldn't matter, since all the tests take very little time to run;
    • I don't think it's necessary to backport this to 2.7/3.3/3.4 because it's a somewhat major refactoring, and if a bug is introduced by other changes the tests in 3.5 will find it (I expect all the bug fixes and new features to land in 3.5 too);

    @ezio-melotti ezio-melotti added the type-bug An unexpected behavior, bug, or error label Feb 14, 2014
    @ezio-melotti ezio-melotti self-assigned this Feb 14, 2014
    @ezio-melotti ezio-melotti added the tests Tests in the Lib/test dir label Feb 14, 2014
    @serhiy-storchaka serhiy-storchaka added 3.8 only security fixes type-feature A feature request or enhancement and removed type-bug An unexpected behavior, bug, or error labels Dec 12, 2018
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.8 only security fixes tests Tests in the Lib/test dir type-feature A feature request or enhancement
    Projects
    Status: Todo
    Development

    No branches or pull requests

    2 participants