Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
08f36035
Kaydet (Commit)
08f36035
authored
Agu 16, 2018
tarafından
Matthijs Kooijman
Kaydeden (comit)
Tim Graham
Agu 23, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #29704 -- Fixed manage.py test --testrunner if it isn't followed by an equals sign.
üst
69071e7f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
6 deletions
+28
-6
test.py
django/core/management/commands/test.py
+2
-5
utils.py
django/core/management/utils.py
+17
-1
tests.py
tests/test_runner/tests.py
+9
-0
No files found.
django/core/management/commands/test.py
Dosyayı görüntüle @
08f36035
...
...
@@ -2,6 +2,7 @@ import sys
from
django.conf
import
settings
from
django.core.management.base
import
BaseCommand
from
django.core.management.utils
import
get_command_line_option
from
django.test.utils
import
get_runner
...
...
@@ -18,11 +19,7 @@ class Command(BaseCommand):
option. This allows a test runner to define additional command line
arguments.
"""
option
=
'--testrunner='
for
arg
in
argv
[
2
:]:
if
arg
.
startswith
(
option
):
self
.
test_runner
=
arg
[
len
(
option
):]
break
self
.
test_runner
=
get_command_line_option
(
argv
,
'--testrunner'
)
super
()
.
run_from_argv
(
argv
)
def
add_arguments
(
self
,
parser
):
...
...
django/core/management/utils.py
Dosyayı görüntüle @
08f36035
...
...
@@ -5,7 +5,7 @@ from django.apps import apps as installed_apps
from
django.utils.crypto
import
get_random_string
from
django.utils.encoding
import
DEFAULT_LOCALE_ENCODING
from
.base
import
CommandError
from
.base
import
CommandError
,
CommandParser
def
popen_wrapper
(
args
,
stdout_encoding
=
'utf-8'
):
...
...
@@ -106,3 +106,19 @@ def parse_apps_and_model_labels(labels):
apps
.
add
(
app_config
)
return
models
,
apps
def
get_command_line_option
(
argv
,
option
):
"""
Return the value of a command line option (which should include leading
dashes, e.g. '--testrunnner') from an argument list. Return None if the
option wasn't passed or if the argument list couldn't be parsed.
"""
parser
=
CommandParser
(
add_help
=
False
,
allow_abbrev
=
False
)
parser
.
add_argument
(
option
,
dest
=
'value'
)
try
:
options
,
_
=
parser
.
parse_known_args
(
argv
[
2
:])
except
CommandError
:
return
None
else
:
return
options
.
value
tests/test_runner/tests.py
Dosyayı görüntüle @
08f36035
...
...
@@ -201,6 +201,15 @@ class CustomTestRunnerOptionsCmdlineTests(AdminScriptTestCase):
def
tearDown
(
self
):
self
.
remove_settings
(
'settings.py'
)
def
test_testrunner_option
(
self
):
args
=
[
'test'
,
'--testrunner'
,
'test_runner.runner.CustomOptionsTestRunner'
,
'--option_a=bar'
,
'--option_b=foo'
,
'--option_c=31337'
]
out
,
err
=
self
.
run_django_admin
(
args
,
'test_project.settings'
)
self
.
assertNoOutput
(
err
)
self
.
assertOutput
(
out
,
'bar:foo:31337'
)
def
test_testrunner_equals
(
self
):
args
=
[
'test'
,
'--testrunner=test_runner.runner.CustomOptionsTestRunner'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment