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
8e1a7dab
Kaydet (Commit)
8e1a7dab
authored
Ock 04, 2018
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Reorganized test_runner test apps.
üst
d7b2aa24
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
38 additions
and
36 deletions
+38
-36
runtests.py
tests/runtests.py
+1
-2
test_discover_runner.py
tests/test_runner/test_discover_runner.py
+21
-21
__init__.py
tests/test_runner_apps/__init__.py
+0
-0
__init__.py
tests/test_runner_apps/sample/__init__.py
+0
-0
doctests.py
tests/test_runner_apps/sample/doctests.py
+0
-0
empty.py
tests/test_runner_apps/sample/empty.py
+0
-0
pattern_tests.py
tests/test_runner_apps/sample/pattern_tests.py
+0
-0
__init__.py
tests/test_runner_apps/sample/tests/__init__.py
+0
-0
tests.py
tests/test_runner_apps/sample/tests/tests.py
+0
-0
tests_sample.py
tests/test_runner_apps/sample/tests_sample.py
+1
-13
__init__.py
tests/test_runner_apps/simple/__init__.py
+0
-0
tests.py
tests/test_runner_apps/simple/tests.py
+0
-0
__init__.py
tests/test_runner_apps/tagged/__init__.py
+0
-0
tests.py
tests/test_runner_apps/tagged/tests.py
+15
-0
No files found.
tests/runtests.py
Dosyayı görüntüle @
8e1a7dab
...
@@ -44,8 +44,7 @@ atexit.register(shutil.rmtree, TMPDIR)
...
@@ -44,8 +44,7 @@ atexit.register(shutil.rmtree, TMPDIR)
SUBDIRS_TO_SKIP
=
[
SUBDIRS_TO_SKIP
=
[
'data'
,
'data'
,
'import_error_package'
,
'import_error_package'
,
'test_discovery_sample'
,
'test_runner_apps'
,
'test_discovery_sample2'
,
]
]
ALWAYS_INSTALLED_APPS
=
[
ALWAYS_INSTALLED_APPS
=
[
...
...
tests/test_runner/test_discover_runner.py
Dosyayı görüntüle @
8e1a7dab
...
@@ -36,28 +36,28 @@ class DiscoverRunnerTest(TestCase):
...
@@ -36,28 +36,28 @@ class DiscoverRunnerTest(TestCase):
def
test_dotted_test_module
(
self
):
def
test_dotted_test_module
(
self
):
count
=
DiscoverRunner
()
.
build_suite
(
count
=
DiscoverRunner
()
.
build_suite
(
[
"test_discovery_sample.tests_sample"
],
[
'test_runner_apps.sample.tests_sample'
],
)
.
countTestCases
()
)
.
countTestCases
()
self
.
assertEqual
(
count
,
6
)
self
.
assertEqual
(
count
,
4
)
def
test_dotted_test_class_vanilla_unittest
(
self
):
def
test_dotted_test_class_vanilla_unittest
(
self
):
count
=
DiscoverRunner
()
.
build_suite
(
count
=
DiscoverRunner
()
.
build_suite
(
[
"test_discovery_sample.tests_sample.TestVanillaUnittest"
],
[
'test_runner_apps.sample.tests_sample.TestVanillaUnittest'
],
)
.
countTestCases
()
)
.
countTestCases
()
self
.
assertEqual
(
count
,
1
)
self
.
assertEqual
(
count
,
1
)
def
test_dotted_test_class_django_testcase
(
self
):
def
test_dotted_test_class_django_testcase
(
self
):
count
=
DiscoverRunner
()
.
build_suite
(
count
=
DiscoverRunner
()
.
build_suite
(
[
"test_discovery_sample.tests_sample.TestDjangoTestCase"
],
[
'test_runner_apps.sample.tests_sample.TestDjangoTestCase'
],
)
.
countTestCases
()
)
.
countTestCases
()
self
.
assertEqual
(
count
,
1
)
self
.
assertEqual
(
count
,
1
)
def
test_dotted_test_method_django_testcase
(
self
):
def
test_dotted_test_method_django_testcase
(
self
):
count
=
DiscoverRunner
()
.
build_suite
(
count
=
DiscoverRunner
()
.
build_suite
(
[
"test_discovery_sample.tests_sample.TestDjangoTestCase.test_sample"
],
[
'test_runner_apps.sample.tests_sample.TestDjangoTestCase.test_sample'
],
)
.
countTestCases
()
)
.
countTestCases
()
self
.
assertEqual
(
count
,
1
)
self
.
assertEqual
(
count
,
1
)
...
@@ -65,17 +65,17 @@ class DiscoverRunnerTest(TestCase):
...
@@ -65,17 +65,17 @@ class DiscoverRunnerTest(TestCase):
def
test_pattern
(
self
):
def
test_pattern
(
self
):
count
=
DiscoverRunner
(
count
=
DiscoverRunner
(
pattern
=
"*_tests.py"
,
pattern
=
"*_tests.py"
,
)
.
build_suite
([
"test_discovery_sample"
])
.
countTestCases
()
)
.
build_suite
([
'test_runner_apps.sample'
])
.
countTestCases
()
self
.
assertEqual
(
count
,
1
)
self
.
assertEqual
(
count
,
1
)
def
test_file_path
(
self
):
def
test_file_path
(
self
):
with
change_cwd
(
".."
):
with
change_cwd
(
".."
):
count
=
DiscoverRunner
()
.
build_suite
(
count
=
DiscoverRunner
()
.
build_suite
(
[
"test_discovery_sample/"
],
[
'test_runner_apps/sample/'
],
)
.
countTestCases
()
)
.
countTestCases
()
self
.
assertEqual
(
count
,
7
)
self
.
assertEqual
(
count
,
5
)
def
test_empty_label
(
self
):
def
test_empty_label
(
self
):
"""
"""
...
@@ -91,14 +91,14 @@ class DiscoverRunnerTest(TestCase):
...
@@ -91,14 +91,14 @@ class DiscoverRunnerTest(TestCase):
def
test_empty_test_case
(
self
):
def
test_empty_test_case
(
self
):
count
=
DiscoverRunner
()
.
build_suite
(
count
=
DiscoverRunner
()
.
build_suite
(
[
"test_discovery_sample.tests_sample.EmptyTestCase"
],
[
'test_runner_apps.sample.tests_sample.EmptyTestCase'
],
)
.
countTestCases
()
)
.
countTestCases
()
self
.
assertEqual
(
count
,
0
)
self
.
assertEqual
(
count
,
0
)
def
test_discovery_on_package
(
self
):
def
test_discovery_on_package
(
self
):
count
=
DiscoverRunner
()
.
build_suite
(
count
=
DiscoverRunner
()
.
build_suite
(
[
"test_discovery_sample.tests"
],
[
'test_runner_apps.sample.tests'
],
)
.
countTestCases
()
)
.
countTestCases
()
self
.
assertEqual
(
count
,
1
)
self
.
assertEqual
(
count
,
1
)
...
@@ -112,14 +112,14 @@ class DiscoverRunnerTest(TestCase):
...
@@ -112,14 +112,14 @@ class DiscoverRunnerTest(TestCase):
should not. The discover runner avoids this behavior.
should not. The discover runner avoids this behavior.
"""
"""
count
=
DiscoverRunner
()
.
build_suite
(
count
=
DiscoverRunner
()
.
build_suite
(
[
"test_discovery_sample.empty"
],
[
'test_runner_apps.sample.empty'
],
)
.
countTestCases
()
)
.
countTestCases
()
self
.
assertEqual
(
count
,
0
)
self
.
assertEqual
(
count
,
0
)
def
test_testcase_ordering
(
self
):
def
test_testcase_ordering
(
self
):
with
change_cwd
(
".."
):
with
change_cwd
(
".."
):
suite
=
DiscoverRunner
()
.
build_suite
([
"test_discovery_sample/"
])
suite
=
DiscoverRunner
()
.
build_suite
([
'test_runner_apps/sample/'
])
self
.
assertEqual
(
self
.
assertEqual
(
suite
.
_tests
[
0
]
.
__class__
.
__name__
,
suite
.
_tests
[
0
]
.
__class__
.
__name__
,
'TestDjangoTestCase'
,
'TestDjangoTestCase'
,
...
@@ -149,10 +149,10 @@ class DiscoverRunnerTest(TestCase):
...
@@ -149,10 +149,10 @@ class DiscoverRunnerTest(TestCase):
"""
"""
runner
=
DiscoverRunner
(
reverse
=
True
)
runner
=
DiscoverRunner
(
reverse
=
True
)
suite
=
runner
.
build_suite
(
suite
=
runner
.
build_suite
(
test_labels
=
(
'test_
discovery_sample'
,
'test_discovery_sample2
'
))
test_labels
=
(
'test_
runner_apps.sample'
,
'test_runner_apps.simple
'
))
self
.
assertIn
(
'test_
discovery_sample2
'
,
next
(
iter
(
suite
))
.
id
(),
self
.
assertIn
(
'test_
runner_apps.simple
'
,
next
(
iter
(
suite
))
.
id
(),
msg
=
"Test labels should be reversed."
)
msg
=
"Test labels should be reversed."
)
suite
=
runner
.
build_suite
(
test_labels
=
(
'test_
discovery_sample2
'
,))
suite
=
runner
.
build_suite
(
test_labels
=
(
'test_
runner_apps.simple
'
,))
suite
=
tuple
(
suite
)
suite
=
tuple
(
suite
)
self
.
assertIn
(
'DjangoCase'
,
suite
[
0
]
.
id
(),
self
.
assertIn
(
'DjangoCase'
,
suite
[
0
]
.
id
(),
msg
=
"Test groups should not be reversed."
)
msg
=
"Test groups should not be reversed."
)
...
@@ -185,16 +185,16 @@ class DiscoverRunnerTest(TestCase):
...
@@ -185,16 +185,16 @@ class DiscoverRunnerTest(TestCase):
def
test_tags
(
self
):
def
test_tags
(
self
):
runner
=
DiscoverRunner
(
tags
=
[
'core'
])
runner
=
DiscoverRunner
(
tags
=
[
'core'
])
self
.
assertEqual
(
runner
.
build_suite
([
'test_
discovery_sample.tests_sample
'
])
.
countTestCases
(),
1
)
self
.
assertEqual
(
runner
.
build_suite
([
'test_
runner_apps.tagged.tests
'
])
.
countTestCases
(),
1
)
runner
=
DiscoverRunner
(
tags
=
[
'fast'
])
runner
=
DiscoverRunner
(
tags
=
[
'fast'
])
self
.
assertEqual
(
runner
.
build_suite
([
'test_
discovery_sample.tests_sample
'
])
.
countTestCases
(),
2
)
self
.
assertEqual
(
runner
.
build_suite
([
'test_
runner_apps.tagged.tests
'
])
.
countTestCases
(),
2
)
runner
=
DiscoverRunner
(
tags
=
[
'slow'
])
runner
=
DiscoverRunner
(
tags
=
[
'slow'
])
self
.
assertEqual
(
runner
.
build_suite
([
'test_
discovery_sample.tests_sample
'
])
.
countTestCases
(),
2
)
self
.
assertEqual
(
runner
.
build_suite
([
'test_
runner_apps.tagged.tests
'
])
.
countTestCases
(),
2
)
def
test_exclude_tags
(
self
):
def
test_exclude_tags
(
self
):
runner
=
DiscoverRunner
(
tags
=
[
'fast'
],
exclude_tags
=
[
'core'
])
runner
=
DiscoverRunner
(
tags
=
[
'fast'
],
exclude_tags
=
[
'core'
])
self
.
assertEqual
(
runner
.
build_suite
([
'test_
discovery_sample.tests_sample
'
])
.
countTestCases
(),
1
)
self
.
assertEqual
(
runner
.
build_suite
([
'test_
runner_apps.tagged.tests
'
])
.
countTestCases
(),
1
)
runner
=
DiscoverRunner
(
tags
=
[
'fast'
],
exclude_tags
=
[
'slow'
])
runner
=
DiscoverRunner
(
tags
=
[
'fast'
],
exclude_tags
=
[
'slow'
])
self
.
assertEqual
(
runner
.
build_suite
([
'test_
discovery_sample.tests_sample
'
])
.
countTestCases
(),
0
)
self
.
assertEqual
(
runner
.
build_suite
([
'test_
runner_apps.tagged.tests
'
])
.
countTestCases
(),
0
)
runner
=
DiscoverRunner
(
exclude_tags
=
[
'slow'
])
runner
=
DiscoverRunner
(
exclude_tags
=
[
'slow'
])
self
.
assertEqual
(
runner
.
build_suite
([
'test_
discovery_sample.tests_sample'
])
.
countTestCases
(),
4
)
self
.
assertEqual
(
runner
.
build_suite
([
'test_
runner_apps.tagged.tests'
])
.
countTestCases
(),
0
)
tests/test_
discovery_sample
/__init__.py
→
tests/test_
runner_apps
/__init__.py
Dosyayı görüntüle @
8e1a7dab
File moved
tests/test_
discovery_sample/tests
/__init__.py
→
tests/test_
runner_apps/sample
/__init__.py
Dosyayı görüntüle @
8e1a7dab
File moved
tests/test_
discovery_
sample/doctests.py
→
tests/test_
runner_apps/
sample/doctests.py
Dosyayı görüntüle @
8e1a7dab
File moved
tests/test_
discovery_
sample/empty.py
→
tests/test_
runner_apps/
sample/empty.py
Dosyayı görüntüle @
8e1a7dab
File moved
tests/test_
discovery_
sample/pattern_tests.py
→
tests/test_
runner_apps/
sample/pattern_tests.py
Dosyayı görüntüle @
8e1a7dab
File moved
tests/test_
discovery_sample2
/__init__.py
→
tests/test_
runner_apps/sample/tests
/__init__.py
Dosyayı görüntüle @
8e1a7dab
File moved
tests/test_
discovery_
sample/tests/tests.py
→
tests/test_
runner_apps/
sample/tests/tests.py
Dosyayı görüntüle @
8e1a7dab
File moved
tests/test_
discovery_
sample/tests_sample.py
→
tests/test_
runner_apps/
sample/tests_sample.py
Dosyayı görüntüle @
8e1a7dab
import
doctest
import
doctest
from
unittest
import
TestCase
from
unittest
import
TestCase
from
django.test
import
SimpleTestCase
,
TestCase
as
DjangoTestCase
,
tag
from
django.test
import
SimpleTestCase
,
TestCase
as
DjangoTestCase
from
.
import
doctests
from
.
import
doctests
...
@@ -29,18 +29,6 @@ class EmptyTestCase(TestCase):
...
@@ -29,18 +29,6 @@ class EmptyTestCase(TestCase):
pass
pass
@tag
(
'slow'
)
class
TaggedTestCase
(
TestCase
):
@tag
(
'fast'
)
def
test_single_tag
(
self
):
self
.
assertEqual
(
1
,
1
)
@tag
(
'fast'
,
'core'
)
def
test_multiple_tags
(
self
):
self
.
assertEqual
(
1
,
1
)
def
load_tests
(
loader
,
tests
,
ignore
):
def
load_tests
(
loader
,
tests
,
ignore
):
tests
.
addTests
(
doctest
.
DocTestSuite
(
doctests
))
tests
.
addTests
(
doctest
.
DocTestSuite
(
doctests
))
return
tests
return
tests
tests/test_runner_apps/simple/__init__.py
0 → 100644
Dosyayı görüntüle @
8e1a7dab
tests/test_
discovery_sample2
/tests.py
→
tests/test_
runner_apps/simple
/tests.py
Dosyayı görüntüle @
8e1a7dab
File moved
tests/test_runner_apps/tagged/__init__.py
0 → 100644
Dosyayı görüntüle @
8e1a7dab
tests/test_runner_apps/tagged/tests.py
0 → 100644
Dosyayı görüntüle @
8e1a7dab
from
unittest
import
TestCase
from
django.test
import
tag
@tag
(
'slow'
)
class
TaggedTestCase
(
TestCase
):
@tag
(
'fast'
)
def
test_single_tag
(
self
):
self
.
assertEqual
(
1
,
1
)
@tag
(
'fast'
,
'core'
)
def
test_multiple_tags
(
self
):
self
.
assertEqual
(
1
,
1
)
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