Fixed #22068 -- Made runtests.py remove trailing slashes from test labels.
When using tab-completion it's easy to accidentally run a test with a trailing slash, which causes INSTALLED_APPS to be set incorrectly. Normalize the test labels to avoid this common error. Thanks MattBlack for the suggestion.
This commit is contained in:
parent
42736ac8e8
commit
68efbfde5e
|
@ -340,6 +340,10 @@ if __name__ == "__main__":
|
||||||
'--selenium', action='store_true', dest='selenium', default=False,
|
'--selenium', action='store_true', dest='selenium', default=False,
|
||||||
help='Run the Selenium tests as well (if Selenium is installed)')
|
help='Run the Selenium tests as well (if Selenium is installed)')
|
||||||
options = parser.parse_args()
|
options = parser.parse_args()
|
||||||
|
|
||||||
|
# Allow including a trailing slash on app_labels for tab completion convenience
|
||||||
|
options.modules = [os.path.normpath(labels) for labels in options.modules]
|
||||||
|
|
||||||
if options.settings:
|
if options.settings:
|
||||||
os.environ['DJANGO_SETTINGS_MODULE'] = options.settings
|
os.environ['DJANGO_SETTINGS_MODULE'] = options.settings
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue