homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: unittest: _top_level_dir is incorrectly persisted between calls to different load_test methods
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ZackerySpytz, igorsobreira, michael.foord, r.david.murray
Priority: normal Keywords: patch

Created on 2012年06月06日 01:20 by r.david.murray, last changed 2022年04月11日 14:57 by admin.

Files
File name Uploaded Description Edit
restore_top_level_dir.patch igorsobreira, 2012年07月19日 22:56 review
restore_top_level_dir_to_previous_value.patch igorsobreira, 2012年07月20日 18:35 review
Pull Requests
URL Status Linked Edit
PR 15242 open ZackerySpytz, 2019年08月13日 01:10
Messages (5)
msg162387 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012年06月06日 01:20
During the execution of the load tests protocol, the loader instance will set its _top_level_dir attribute, and this will persist if the loader is passed on to another load_tests method. If that method does not specify a top_level_dir in a discovery call, the wrong top_level_dir may be used, and loading will fail.
You can reproduce this by having two test *packages* with a load_tests method that calls discover in their __init__.py, and specify both package names to the unittest CLI.
msg165887 - (view) Author: Igor Sobreira (igorsobreira) Date: 2012年07月19日 22:56
Hello. I've attached a patch to cleanup self._top_level_dir in the end of discover(). Is that the expected behavior or I'm on the wrong track?
msg165954 - (view) Author: Igor Sobreira (igorsobreira) Date: 2012年07月20日 17:38
My previous patch is incorrect, talking to voidspace on irc self._top_leve_dir should be reverted to it's previous value
"so when discover is called the original value should be stored, then discovery done, and then the original restored"
I'll work on this one.
He also pointed out that this bugfix should be backported to 2.7 and 3.2
msg165966 - (view) Author: Igor Sobreira (igorsobreira) Date: 2012年07月20日 18:35
Updated patch to restore previous value of ._top_level_dir on discover() done. And added a unit test.
msg348649 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019年07月29日 12:01
This issue is not newcomer friendly, I remove the easy keyword.
History
Date User Action Args
2022年04月11日 14:57:31adminsetgithub: 59215
2021年11月27日 11:55:01iritkatriellinkissue22811 superseder
2021年11月27日 11:54:46iritkatrielsetversions: + Python 3.10, Python 3.11, - Python 2.7, Python 3.7, Python 3.8
2019年08月13日 12:18:54vstinnersetnosy: - vstinner
2019年08月13日 01:12:14ZackerySpytzsetnosy: + ZackerySpytz

versions: + Python 3.7, Python 3.8, Python 3.9, - Python 3.2, Python 3.3
2019年08月13日 01:10:28ZackerySpytzsetstage: needs patch -> patch review
pull_requests: + pull_request14963
2019年07月29日 12:01:51vstinnersetkeywords: - easy
nosy: + vstinner
messages: + msg348649

2012年07月20日 18:35:19igorsobreirasetfiles: + restore_top_level_dir_to_previous_value.patch

messages: + msg165966
2012年07月20日 17:38:30igorsobreirasetmessages: + msg165954
2012年07月19日 22:56:56igorsobreirasetfiles: + restore_top_level_dir.patch

nosy: + igorsobreira
messages: + msg165887

keywords: + patch
2012年06月06日 01:20:42r.david.murraycreate

AltStyle によって変換されたページ (->オリジナル) /