Opened 8 years ago

Closed 8 years ago

#26976 closed Cleanup/optimization (fixed)

Make it easier to change what LiveServerThread class is used

Reported by: Chris Jerdonek Owned by: Chris Jerdonek
Component: Testing framework Version: 1.9
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

Currently, it's not so easy to use a modified LiveServerThread inside LiveServerTestCase. This is because LiveServerTestCase instantiates a LiveServerThread object inside _create_server_thread() (see here for a direct link to the code) and "hard codes" the class name:

@classmethod
def _create_server_thread(cls, connections_override):
    return LiveServerThread(
        cls.host,
        cls.static_handler,
        connections_override=connections_override,
    )

An easy solution would be to add a LiveServerTestCase.server_thread_class class attribute, similar to how other classes are handled throughout the test framework code to allow easier subclassing.

Change History (5)

comment:1 by Tim Graham, 8 years ago

Component: UncategorizedTesting framework
Easy pickings: set
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

I suppose no tests or docs are needed for that.

comment:2 by Chris Jerdonek, 8 years ago

Owner: changed from nobody to Chris Jerdonek
Status: newassigned

comment:3 by Chris Jerdonek, 8 years ago

I posted a pull request here.

I also ran the following test command to make sure it works (and confirmed that some of these tests fail if the change was made incorrectly):

$ ./runtests.py --parallel 1 servers.tests

comment:4 by Chris Jerdonek, 8 years ago

Has patch: set

comment:5 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: assignedclosed

In 013ee21:

Fixed #26976 -- Added LiveServerTestCase.server_thread_class to ease subclassing.

Note: See TracTickets for help on using tickets.
Back to Top