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
7df72dcd
Kaydet (Commit)
7df72dcd
authored
Eki 17, 2009
tarafından
Nick Coghlan
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Restore original sys.path when running TTK tests
üst
e363b143
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
8 deletions
+33
-8
test_support.py
Lib/test/test_support.py
+25
-0
test_ttk_guionly.py
Lib/test/test_ttk_guionly.py
+4
-4
test_ttk_textonly.py
Lib/test/test_ttk_textonly.py
+4
-4
No files found.
Lib/test/test_support.py
Dosyayı görüntüle @
7df72dcd
...
@@ -578,6 +578,31 @@ class EnvironmentVarGuard(UserDict.DictMixin):
...
@@ -578,6 +578,31 @@ class EnvironmentVarGuard(UserDict.DictMixin):
self
.
_environ
[
k
]
=
v
self
.
_environ
[
k
]
=
v
class
DirsOnSysPath
(
object
):
"""Context manager to temporarily add directories to sys.path.
This makes a copy of sys.path, appends any directories given
as positional arguments, then reverts sys.path to the copied
settings when the context ends.
Note that *all* sys.path modifications in the body of the
context manager, including replacement of the object,
will be reverted at the end of the block.
"""
def
__init__
(
self
,
*
paths
):
self
.
original_value
=
sys
.
path
[:]
self
.
original_object
=
sys
.
path
sys
.
path
.
extend
(
paths
)
def
__enter__
(
self
):
return
self
def
__exit__
(
self
,
*
ignore_exc
):
sys
.
path
=
self
.
original_object
sys
.
path
[:]
=
self
.
original_value
class
TransientResource
(
object
):
class
TransientResource
(
object
):
"""Raise ResourceDenied if an exception is raised while the context manager
"""Raise ResourceDenied if an exception is raised while the context manager
...
...
Lib/test/test_ttk_guionly.py
Dosyayı görüntüle @
7df72dcd
...
@@ -18,10 +18,9 @@ except TclError, msg:
...
@@ -18,10 +18,9 @@ except TclError, msg:
this_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
this_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
lib_tk_test
=
os
.
path
.
abspath
(
os
.
path
.
join
(
this_dir
,
os
.
path
.
pardir
,
lib_tk_test
=
os
.
path
.
abspath
(
os
.
path
.
join
(
this_dir
,
os
.
path
.
pardir
,
'lib-tk'
,
'test'
))
'lib-tk'
,
'test'
))
if
lib_tk_test
not
in
sys
.
path
:
sys
.
path
.
append
(
lib_tk_test
)
import
runtktests
with
test_support
.
DirsOnSysPath
(
lib_tk_test
):
import
runtktests
def
test_main
(
enable_gui
=
False
):
def
test_main
(
enable_gui
=
False
):
if
enable_gui
:
if
enable_gui
:
...
@@ -30,7 +29,8 @@ def test_main(enable_gui=False):
...
@@ -30,7 +29,8 @@ def test_main(enable_gui=False):
elif
'gui'
not
in
test_support
.
use_resources
:
elif
'gui'
not
in
test_support
.
use_resources
:
test_support
.
use_resources
.
append
(
'gui'
)
test_support
.
use_resources
.
append
(
'gui'
)
test_support
.
run_unittest
(
with
test_support
.
DirsOnSysPath
(
lib_tk_test
):
test_support
.
run_unittest
(
*
runtktests
.
get_tests
(
text
=
False
,
packages
=
[
'test_ttk'
]))
*
runtktests
.
get_tests
(
text
=
False
,
packages
=
[
'test_ttk'
]))
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
Lib/test/test_ttk_textonly.py
Dosyayı görüntüle @
7df72dcd
...
@@ -7,13 +7,13 @@ test_support.import_module('_tkinter')
...
@@ -7,13 +7,13 @@ test_support.import_module('_tkinter')
this_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
this_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
lib_tk_test
=
os
.
path
.
abspath
(
os
.
path
.
join
(
this_dir
,
'..'
,
'lib-tk'
,
'test'
))
lib_tk_test
=
os
.
path
.
abspath
(
os
.
path
.
join
(
this_dir
,
'..'
,
'lib-tk'
,
'test'
))
if
lib_tk_test
not
in
sys
.
path
:
sys
.
path
.
append
(
lib_tk_test
)
import
runtktests
with
test_support
.
DirsOnSysPath
(
lib_tk_test
):
import
runtktests
def
test_main
():
def
test_main
():
test_support
.
run_unittest
(
with
test_support
.
DirsOnSysPath
(
lib_tk_test
):
test_support
.
run_unittest
(
*
runtktests
.
get_tests
(
gui
=
False
,
packages
=
[
'test_ttk'
]))
*
runtktests
.
get_tests
(
gui
=
False
,
packages
=
[
'test_ttk'
]))
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
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