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
1b51c3d4
Kaydet (Commit)
1b51c3d4
authored
Mar 13, 2010
tarafından
Florent Xicluna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Do not chdir when running test_xml_etree, and enhance the findfile helper.
üst
13ba1a1c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
27 deletions
+12
-27
test_minidom.py
Lib/test/test_minidom.py
+3
-9
test_sax.py
Lib/test/test_sax.py
+2
-3
test_support.py
Lib/test/test_support.py
+3
-1
test_xml_etree.py
Lib/test/test_xml_etree.py
+4
-14
No files found.
Lib/test/test_minidom.py
Dosyayı görüntüle @
1b51c3d4
# test for xml.dom.minidom
import
os
import
sys
import
pickle
from
StringIO
import
StringIO
from
test.test_support
import
verbose
,
run_unittest
from
test.test_support
import
verbose
,
run_unittest
,
findfile
import
unittest
import
xml.dom
...
...
@@ -15,12 +13,8 @@ from xml.dom.minidom import parse, Node, Document, parseString
from
xml.dom.minidom
import
getDOMImplementation
if
__name__
==
"__main__"
:
base
=
sys
.
argv
[
0
]
else
:
base
=
__file__
tstfile
=
os
.
path
.
join
(
os
.
path
.
dirname
(
base
),
"xmltestdata"
,
"test.xml"
)
del
base
tstfile
=
findfile
(
"test.xml"
,
subdir
=
"xmltestdata"
)
# The tests of DocumentType importing use these helpers to construct
# the documents to work with, since not all DOM builders actually
...
...
Lib/test/test_sax.py
Dosyayı görüntüle @
1b51c3d4
...
...
@@ -15,10 +15,9 @@ from xml.sax.xmlreader import InputSource, AttributesImpl, AttributesNSImpl
from
cStringIO
import
StringIO
from
test.test_support
import
findfile
,
run_unittest
import
unittest
import
os
TEST_XMLFILE
=
findfile
(
os
.
path
.
join
(
"xmltestdata"
,
"test.xml"
)
)
TEST_XMLFILE_OUT
=
findfile
(
os
.
path
.
join
(
"xmltestdata"
,
"test.xml.out"
)
)
TEST_XMLFILE
=
findfile
(
"test.xml"
,
subdir
=
"xmltestdata"
)
TEST_XMLFILE_OUT
=
findfile
(
"test.xml.out"
,
subdir
=
"xmltestdata"
)
ns_uri
=
"http://www.python.org/xml-ns/saxtest/"
...
...
Lib/test/test_support.py
Dosyayı görüntüle @
1b51c3d4
...
...
@@ -424,12 +424,14 @@ def temp_cwd(name='tempcwd', quiet=False):
rmtree
(
name
)
def
findfile
(
file
,
here
=
__file__
):
def
findfile
(
file
,
here
=
__file__
,
subdir
=
None
):
"""Try to find a file on sys.path and the working directory. If it is not
found the argument passed to the function is returned (this does not
necessarily signal failure; could still be the legitimate path)."""
if
os
.
path
.
isabs
(
file
):
return
file
if
subdir
is
not
None
:
file
=
os
.
path
.
join
(
subdir
,
file
)
path
=
sys
.
path
path
=
[
os
.
path
.
dirname
(
here
)]
+
path
for
dn
in
path
:
...
...
Lib/test/test_xml_etree.py
Dosyayı görüntüle @
1b51c3d4
...
...
@@ -14,11 +14,12 @@
import
sys
from
test
import
test_support
from
test.test_support
import
findfile
from
xml.etree
import
ElementTree
as
ET
SIMPLE_XMLFILE
=
"xmltestdata/simple.xml"
SIMPLE_NS_XMLFILE
=
"xmltestdata/simple-ns.xml"
SIMPLE_XMLFILE
=
findfile
(
"simple.xml"
,
subdir
=
"xmltestdata"
)
SIMPLE_NS_XMLFILE
=
findfile
(
"simple-ns.xml"
,
subdir
=
"xmltestdata"
)
SAMPLE_XML
=
"""
\
<body>
...
...
@@ -1791,30 +1792,19 @@ def check_issue6565():
class
CleanContext
(
object
):
"""Provide default namespace mapping
, path cache and working directory.
"""Provide default namespace mapping
and path cache."""
Save and restore the default namespace mapping and the path cache.
Change directory to the "Lib/test/" directory: some tests open
xml files in the "samples/" directory relative to the test module.
"""
def
__enter__
(
self
):
import
os
from
xml.etree
import
ElementTree
self
.
_nsmap
=
ElementTree
.
_namespace_map
self
.
_path_cache
=
ElementTree
.
ElementPath
.
_cache
self
.
_previous_cwd
=
os
.
getcwd
()
# Copy the default namespace mapping
ElementTree
.
_namespace_map
=
self
.
_nsmap
.
copy
()
# Copy the path cache (should be empty)
ElementTree
.
ElementPath
.
_cache
=
self
.
_path_cache
.
copy
()
# Change directory to Lib/test/
os
.
chdir
(
os
.
path
.
dirname
(
__file__
))
def
__exit__
(
self
,
*
args
):
import
os
from
xml.etree
import
ElementTree
# Restore working directory
os
.
chdir
(
self
.
_previous_cwd
)
# Restore mapping and path cache
ElementTree
.
_namespace_map
=
self
.
_nsmap
ElementTree
.
ElementPath
.
_cache
=
self
.
_path_cache
...
...
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