Opened 9 years ago
Closed 9 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 , 9 years ago
| Component: | Uncategorized → Testing framework | 
|---|---|
| Easy pickings: | set | 
| Triage Stage: | Unreviewed → Accepted | 
| Type: | Uncategorized → Cleanup/optimization | 
comment:2 by , 9 years ago
| Owner: | changed from to | 
|---|---|
| Status: | new → assigned | 
comment:3 by , 9 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 , 9 years ago
| Has patch: | set | 
|---|
I suppose no tests or docs are needed for that.