Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
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
cpython
Commits
e7e1375e
Kaydet (Commit)
e7e1375e
authored
Haz 02, 2014
tarafından
Zachary Ware
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #18492: Merge with 3.4
üst
2bc4d95b
66f29284
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
37 additions
and
59 deletions
+37
-59
FormatParagraph.py
Lib/idlelib/FormatParagraph.py
+0
-1
IdleHistory.py
Lib/idlelib/IdleHistory.py
+0
-2
SearchEngine.py
Lib/idlelib/SearchEngine.py
+0
-1
README.txt
Lib/idlelib/idle_test/README.txt
+21
-16
__init__.py
Lib/test/support/__init__.py
+7
-13
test_codecmaps_hk.py
Lib/test/test_codecmaps_hk.py
+0
-1
test_decimal.py
Lib/test/test_decimal.py
+2
-2
test_idle.py
Lib/test/test_idle.py
+0
-4
test_imaplib.py
Lib/test/test_imaplib.py
+0
-1
test_robotparser.py
Lib/test/test_robotparser.py
+0
-1
test_tk.py
Lib/test/test_tk.py
+2
-8
test_ttk_guionly.py
Lib/test/test_ttk_guionly.py
+2
-8
runtktests.py
Lib/tkinter/test/runtktests.py
+0
-1
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/idlelib/FormatParagraph.py
Dosyayı görüntüle @
e7e1375e
...
@@ -188,7 +188,6 @@ def get_comment_header(line):
...
@@ -188,7 +188,6 @@ def get_comment_header(line):
return
m
.
group
(
1
)
return
m
.
group
(
1
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
from
test
import
support
;
support
.
use_resources
=
[
'gui'
]
import
unittest
import
unittest
unittest
.
main
(
'idlelib.idle_test.test_formatparagraph'
,
unittest
.
main
(
'idlelib.idle_test.test_formatparagraph'
,
verbosity
=
2
,
exit
=
False
)
verbosity
=
2
,
exit
=
False
)
Lib/idlelib/IdleHistory.py
Dosyayı görüntüle @
e7e1375e
...
@@ -100,7 +100,5 @@ class History:
...
@@ -100,7 +100,5 @@ class History:
self
.
prefix
=
None
self
.
prefix
=
None
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
from
test
import
support
support
.
use_resources
=
[
'gui'
]
from
unittest
import
main
from
unittest
import
main
main
(
'idlelib.idle_test.test_idlehistory'
,
verbosity
=
2
,
exit
=
False
)
main
(
'idlelib.idle_test.test_idlehistory'
,
verbosity
=
2
,
exit
=
False
)
Lib/idlelib/SearchEngine.py
Dosyayı görüntüle @
e7e1375e
...
@@ -229,6 +229,5 @@ def get_line_col(index):
...
@@ -229,6 +229,5 @@ def get_line_col(index):
return
line
,
col
return
line
,
col
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
from
test
import
support
;
support
.
use_resources
=
[
'gui'
]
import
unittest
import
unittest
unittest
.
main
(
'idlelib.idle_test.test_searchengine'
,
verbosity
=
2
,
exit
=
False
)
unittest
.
main
(
'idlelib.idle_test.test_searchengine'
,
verbosity
=
2
,
exit
=
False
)
Lib/idlelib/idle_test/README.txt
Dosyayı görüntüle @
e7e1375e
...
@@ -26,7 +26,6 @@ Once test_xyy is written, the following should go at the end of xyy.py,
...
@@ -26,7 +26,6 @@ Once test_xyy is written, the following should go at the end of xyy.py,
with xyz (lowercased) added after 'test_'.
with xyz (lowercased) added after 'test_'.
---
---
if __name__ == "__main__":
if __name__ == "__main__":
from test import support; support.use_resources = ['gui']
import unittest
import unittest
unittest.main('idlelib.idle_test.test_', verbosity=2, exit=False)
unittest.main('idlelib.idle_test.test_', verbosity=2, exit=False)
---
---
...
@@ -34,12 +33,12 @@ if __name__ == "__main__":
...
@@ -34,12 +33,12 @@ if __name__ == "__main__":
2. Gui Tests
2. Gui Tests
Gui tests need 'requires'
and 'use_resources' from test.support
Gui tests need 'requires'
from test.support (test.test_support in 2.7). A
(test.test_support in 2.7). A test is a gui test if it creates a Tk root or
test is a gui test if it creates a Tk root or master object either directly
master object either directly or indirectly by instantiating a tkinter or
or indirectly by instantiating a tkinter or idle class. For the benefit of
idle class. For the benefit of buildbot machines that do not have a graphics
test processes that either have no graphical environment available or are not
screen, gui tests must be 'guarded' by "requires('gui')" in a setUp
allowed to use it, gui tests must be 'guarded' by "requires('gui')" in a
function or method. This will typically be setUpClass.
setUp
function or method. This will typically be setUpClass.
To avoid interfering with other gui tests, all gui objects must be destroyed
To avoid interfering with other gui tests, all gui objects must be destroyed
and deleted by the end of the test. If a widget, such as a Tk root, is created
and deleted by the end of the test. If a widget, such as a Tk root, is created
...
@@ -57,11 +56,17 @@ and class attributes, also delete the widget.
...
@@ -57,11 +56,17 @@ and class attributes, also delete the widget.
del cls.root
del cls.root
---
---
Support.requires('gui') returns true if it is either called in a main module
Support.requires('gui') causes the test(s) it guards to be skipped if any of
(which never happens on buildbots) or if use_resources contains 'gui'.
a few conditions are met:
Use_resources is set by test.regrtest but not by unittest. So when running
- The tests are being run by regrtest.py, and it was started without
tests in another module with unittest, we set it ourselves, as in the xyz.py
enabling the "gui" resource with the "-u" command line option.
template above.
- The tests are being run on Windows by a service that is not allowed to
interact with the graphical environment.
- The tests are being run on Mac OSX in a process that cannot make a window
manager connection.
- tkinter.Tk cannot be successfully instantiated for some reason.
- test.support.use_resources has been set by something other than
regrtest.py and does not contain "gui".
Since non-gui tests always run, but gui tests only sometimes, tests of non-gui
Since non-gui tests always run, but gui tests only sometimes, tests of non-gui
operations should best avoid needing a gui. Methods that make incidental use of
operations should best avoid needing a gui. Methods that make incidental use of
...
@@ -88,8 +93,8 @@ python -m idlelib.idle_test.test_xyz
...
@@ -88,8 +93,8 @@ python -m idlelib.idle_test.test_xyz
To run all idle_test/test_*.py tests, either interactively
To run all idle_test/test_*.py tests, either interactively
('>>>', with unittest imported) or from a command line, use one of the
('>>>', with unittest imported) or from a command line, use one of the
following. (Notes:
unittest does not run gui tests; in 2.7, 'test ' (with the
following. (Notes:
in 2.7, 'test ' (with the space) is 'test.regrtest ';
space) is 'test.regrtest ';
where present, -v and -ugui can be omitted.)
where present, -v and -ugui can be omitted.)
>>> unittest.main('idlelib.idle_test', verbosity=2, exit=False)
>>> unittest.main('idlelib.idle_test', verbosity=2, exit=False)
python -m unittest -v idlelib.idle_test
python -m unittest -v idlelib.idle_test
...
@@ -98,13 +103,13 @@ python -m test.test_idle
...
@@ -98,13 +103,13 @@ python -m test.test_idle
The idle tests are 'discovered' by idlelib.idle_test.__init__.load_tests,
The idle tests are 'discovered' by idlelib.idle_test.__init__.load_tests,
which is also imported into test.test_idle. Normally, neither file should be
which is also imported into test.test_idle. Normally, neither file should be
changed when working on individual test modules. The third command runs
runs
changed when working on individual test modules. The third command runs
unittest indirectly through regrtest. The same happens when the entire test
unittest indirectly through regrtest. The same happens when the entire test
suite is run with 'python -m test'. So that command must work for buildbots
suite is run with 'python -m test'. So that command must work for buildbots
to stay green. Idle tests must not disturb the environment in a way that
to stay green. Idle tests must not disturb the environment in a way that
makes other tests fail (issue 18081).
makes other tests fail (issue 18081).
To run an individual Testcase or test method, extend the dotted name given to
To run an individual Testcase or test method, extend the dotted name given to
unittest on the command line.
(But gui tests will not this way.)
unittest on the command line.
python -m unittest -v idlelib.idle_test.test_xyz.Test_case.test_meth
python -m unittest -v idlelib.idle_test.test_xyz.Test_case.test_meth
Lib/test/support/__init__.py
Dosyayı görüntüle @
e7e1375e
...
@@ -454,23 +454,17 @@ def _is_gui_available():
...
@@ -454,23 +454,17 @@ def _is_gui_available():
return
_is_gui_available
.
result
return
_is_gui_available
.
result
def
is_resource_enabled
(
resource
):
def
is_resource_enabled
(
resource
):
"""Test whether a resource is enabled. Known resources are set by
"""Test whether a resource is enabled.
regrtest.py."""
return
use_resources
is
not
None
and
resource
in
use_resources
def
requires
(
resource
,
msg
=
None
):
Known resources are set by regrtest.py. If not running under regrtest.py,
"""Raise ResourceDenied if the specified resource is not available.
all resources are assumed enabled unless use_resources has been set.
If the caller's module is __main__ then automatically return True. The
possibility of False being returned occurs when regrtest.py is
executing.
"""
"""
return
use_resources
is
None
or
resource
in
use_resources
def
requires
(
resource
,
msg
=
None
):
"""Raise ResourceDenied if the specified resource is not available."""
if
resource
==
'gui'
and
not
_is_gui_available
():
if
resource
==
'gui'
and
not
_is_gui_available
():
raise
ResourceDenied
(
_is_gui_available
.
reason
)
raise
ResourceDenied
(
_is_gui_available
.
reason
)
# see if the caller's module is __main__ - if so, treat as if
# the resource was set
if
sys
.
_getframe
(
1
)
.
f_globals
.
get
(
"__name__"
)
==
"__main__"
:
return
if
not
is_resource_enabled
(
resource
):
if
not
is_resource_enabled
(
resource
):
if
msg
is
None
:
if
msg
is
None
:
msg
=
"Use of the
%
r resource not enabled"
%
resource
msg
=
"Use of the
%
r resource not enabled"
%
resource
...
...
Lib/test/test_codecmaps_hk.py
Dosyayı görüntüle @
e7e1375e
...
@@ -16,5 +16,4 @@ def test_main():
...
@@ -16,5 +16,4 @@ def test_main():
support
.
run_unittest
(
__name__
)
support
.
run_unittest
(
__name__
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
support
.
use_resources
=
[
'urlfetch'
]
test_main
()
test_main
()
Lib/test/test_decimal.py
Dosyayı görüntüle @
e7e1375e
...
@@ -5556,7 +5556,7 @@ else:
...
@@ -5556,7 +5556,7 @@ else:
all_tests
.
insert
(
1
,
SignatureTest
)
all_tests
.
insert
(
1
,
SignatureTest
)
def
test_main
(
arith
=
Fals
e
,
verbose
=
None
,
todo_tests
=
None
,
debug
=
None
):
def
test_main
(
arith
=
Non
e
,
verbose
=
None
,
todo_tests
=
None
,
debug
=
None
):
""" Execute the tests.
""" Execute the tests.
Runs all arithmetic tests if arith is True or if the "decimal" resource
Runs all arithmetic tests if arith is True or if the "decimal" resource
...
@@ -5566,7 +5566,7 @@ def test_main(arith=False, verbose=None, todo_tests=None, debug=None):
...
@@ -5566,7 +5566,7 @@ def test_main(arith=False, verbose=None, todo_tests=None, debug=None):
init
(
C
)
init
(
C
)
init
(
P
)
init
(
P
)
global
TEST_ALL
,
DEBUG
global
TEST_ALL
,
DEBUG
TEST_ALL
=
arith
or
is_resource_enabled
(
'decimal'
)
TEST_ALL
=
arith
if
arith
is
not
None
else
is_resource_enabled
(
'decimal'
)
DEBUG
=
debug
DEBUG
=
debug
if
todo_tests
is
None
:
if
todo_tests
is
None
:
...
...
Lib/test/test_idle.py
Dosyayı görüntüle @
e7e1375e
...
@@ -13,8 +13,4 @@ idletest = import_module('idlelib.idle_test')
...
@@ -13,8 +13,4 @@ idletest = import_module('idlelib.idle_test')
load_tests
=
idletest
.
load_tests
load_tests
=
idletest
.
load_tests
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
# Until unittest supports resources, we emulate regrtest's -ugui
# so loaded tests run the same as if textually present here.
# If any Idle test ever needs another resource, add it to the list.
support
.
use_resources
=
[
'gui'
]
# use_resources is initially None
unittest
.
main
(
verbosity
=
2
,
exit
=
False
)
unittest
.
main
(
verbosity
=
2
,
exit
=
False
)
Lib/test/test_imaplib.py
Dosyayı görüntüle @
e7e1375e
...
@@ -501,5 +501,4 @@ def load_tests(*args):
...
@@ -501,5 +501,4 @@ def load_tests(*args):
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
support
.
use_resources
=
[
'network'
]
unittest
.
main
()
unittest
.
main
()
Lib/test/test_robotparser.py
Dosyayı görüntüle @
e7e1375e
...
@@ -291,5 +291,4 @@ def load_tests(loader, suite, pattern):
...
@@ -291,5 +291,4 @@ def load_tests(loader, suite, pattern):
return
suite
return
suite
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
support
.
use_resources
=
[
'network'
]
unittest
.
main
()
unittest
.
main
()
Lib/test/test_tk.py
Dosyayı görüntüle @
e7e1375e
...
@@ -10,15 +10,9 @@ support.requires('gui')
...
@@ -10,15 +10,9 @@ support.requires('gui')
from
tkinter.test
import
runtktests
from
tkinter.test
import
runtktests
def
test_main
(
enable_gui
=
False
):
def
test_main
():
if
enable_gui
:
if
support
.
use_resources
is
None
:
support
.
use_resources
=
[
'gui'
]
elif
'gui'
not
in
support
.
use_resources
:
support
.
use_resources
.
append
(
'gui'
)
support
.
run_unittest
(
support
.
run_unittest
(
*
runtktests
.
get_tests
(
text
=
False
,
packages
=
[
'test_tkinter'
]))
*
runtktests
.
get_tests
(
text
=
False
,
packages
=
[
'test_tkinter'
]))
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
test_main
(
enable_gui
=
True
)
test_main
()
Lib/test/test_ttk_guionly.py
Dosyayı görüntüle @
e7e1375e
...
@@ -22,13 +22,7 @@ except TclError as msg:
...
@@ -22,13 +22,7 @@ except TclError as msg:
# assuming ttk is not available
# assuming ttk is not available
raise
unittest
.
SkipTest
(
"ttk not available:
%
s"
%
msg
)
raise
unittest
.
SkipTest
(
"ttk not available:
%
s"
%
msg
)
def
test_main
(
enable_gui
=
False
):
def
test_main
():
if
enable_gui
:
if
support
.
use_resources
is
None
:
support
.
use_resources
=
[
'gui'
]
elif
'gui'
not
in
support
.
use_resources
:
support
.
use_resources
.
append
(
'gui'
)
try
:
try
:
support
.
run_unittest
(
support
.
run_unittest
(
*
runtktests
.
get_tests
(
text
=
False
,
packages
=
[
'test_ttk'
]))
*
runtktests
.
get_tests
(
text
=
False
,
packages
=
[
'test_ttk'
]))
...
@@ -36,4 +30,4 @@ def test_main(enable_gui=False):
...
@@ -36,4 +30,4 @@ def test_main(enable_gui=False):
get_tk_root
()
.
destroy
()
get_tk_root
()
.
destroy
()
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
test_main
(
enable_gui
=
True
)
test_main
()
Lib/tkinter/test/runtktests.py
Dosyayı görüntüle @
e7e1375e
...
@@ -68,5 +68,4 @@ def get_tests(text=True, gui=True, packages=None):
...
@@ -68,5 +68,4 @@ def get_tests(text=True, gui=True, packages=None):
yield
test
yield
test
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
test
.
support
.
use_resources
=
[
'gui'
]
test
.
support
.
run_unittest
(
*
get_tests
())
test
.
support
.
run_unittest
(
*
get_tests
())
Misc/NEWS
Dosyayı görüntüle @
e7e1375e
...
@@ -531,6 +531,9 @@ Documentation
...
@@ -531,6 +531,9 @@ Documentation
Tests
Tests
-----
-----
-
Issue
#
18492
:
All
resources
are
now
allowed
when
tests
are
not
run
by
regrtest
.
py
.
-
Issue
#
21634
:
Fix
pystone
micro
-
benchmark
:
use
floor
division
instead
of
true
-
Issue
#
21634
:
Fix
pystone
micro
-
benchmark
:
use
floor
division
instead
of
true
division
to
benchmark
integers
instead
of
floating
point
numbers
.
Set
pystone
division
to
benchmark
integers
instead
of
floating
point
numbers
.
Set
pystone
version
to
1.2
.
Patch
written
by
Lennart
Regebro
.
version
to
1.2
.
Patch
written
by
Lennart
Regebro
.
...
...
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