Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Lib/test/decimaltestdata/*.decTest noeol
Lib/test/test_email/data/*.txt noeol
Lib/test/test_importlib/resources/data01/* noeol
Lib/test/test_importlib/resources/namespacedata01/* noeol
Lib/test/xmltestdata/* noeol
Lib/test/test_xml/xmltestdata/* noeol

# Shell scripts should have LF even on Windows because of Cygwin
Lib/venv/scripts/common/activate text eol=lf
Expand Down
2 changes: 1 addition & 1 deletion Doc/license.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ W3C C14N test suite
-------------------

The C14N 2.0 test suite in the :mod:`test` package
(``Lib/test/xmltestdata/c14n-20/``) was retrieved from the W3C website at
(``Lib/test/test_xml/xmltestdata/c14n-20/``) was retrieved from the W3C website at
https://www.w3.org/TR/xml-c14n2-testcases/ and is distributed under the
3-clause BSD license::

Expand Down
1 change: 1 addition & 0 deletions Lib/test/libregrtest/findtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"test_multiprocessing_fork",
"test_multiprocessing_forkserver",
"test_multiprocessing_spawn",
"test_xml",
}


Expand Down
2 changes: 1 addition & 1 deletion Lib/test/ssltests.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'test_asyncio', 'test_ensurepip.py', 'test_ftplib', 'test_hashlib',
'test_hmac', 'test_httplib', 'test_imaplib',
'test_poplib', 'test_ssl', 'test_smtplib', 'test_smtpnet',
'test_urllib2_localnet', 'test_venv', 'test_xmlrpc'
'test_urllib2_localnet', 'test_venv', 'test_xml.test_xmlrpc'
]

def run_regrtests(*extra_args):
Expand Down
2 changes: 2 additions & 0 deletions Lib/test/support/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,8 @@ def findfile(filename, subdir=None):
if os.path.isabs(filename):
return filename
if subdir is not None:
if not isinstance(subdir, str):
subdir = os.path.join(*subdir)
filename = os.path.join(subdir, filename)
path = [TEST_HOME_DIR] + sys.path
for dn in path:
Expand Down
5 changes: 5 additions & 0 deletions Lib/test/test_xml/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import os
from test.support import load_package_tests

def load_tests(*args):
return load_package_tests(os.path.dirname(__file__), *args)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from xml.parsers.expat import ExpatError


tstfile = support.findfile("test.xml", subdir="xmltestdata")
tstfile = support.findfile("test.xml", subdir=("test_xml", "xmltestdata"))
sample = ("<?xml version='1.0' encoding='us-ascii'?>\n"
"<!DOCTYPE doc PUBLIC 'http://xml.python.org/public'"
" 'http://xml.python.org/system' [\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from test.support import findfile


tstfile = findfile("test.xml", subdir="xmltestdata")
tstfile = findfile("test.xml", subdir=("test_xml", "xmltestdata"))

# A handy XML snippet, containing attributes, a namespace prefix, and a
# self-closing tag:
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions Lib/test/test_sax.py → Lib/test/test_xml/test_sax.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
from test.support.os_helper import FakePath, TESTFN


TEST_XMLFILE = findfile("test.xml", subdir="xmltestdata")
TEST_XMLFILE_OUT = findfile("test.xml.out", subdir="xmltestdata")
TEST_XMLFILE = findfile("test.xml", subdir=("test_xml", "xmltestdata"))
TEST_XMLFILE_OUT = findfile("test.xml.out", subdir=("test_xml", "xmltestdata"))
try:
TEST_XMLFILE.encode("utf-8")
TEST_XMLFILE_OUT.encode("utf-8")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
pyET = None
ET = None

SIMPLE_XMLFILE = findfile("simple.xml", subdir="xmltestdata")
SIMPLE_XMLFILE = findfile("simple.xml", subdir=("test_xml", "xmltestdata"))
try:
SIMPLE_XMLFILE.encode("utf-8")
except UnicodeEncodeError:
raise unittest.SkipTest("filename is not encodable to utf8")
SIMPLE_NS_XMLFILE = findfile("simple-ns.xml", subdir="xmltestdata")
UTF8_BUG_XMLFILE = findfile("expat224_utf8_bug.xml", subdir="xmltestdata")
SIMPLE_NS_XMLFILE = findfile("simple-ns.xml", subdir=("test_xml", "xmltestdata"))
UTF8_BUG_XMLFILE = findfile("expat224_utf8_bug.xml", subdir=("test_xml", "xmltestdata"))

SAMPLE_XML = """\
<body>
Expand Down Expand Up @@ -4094,7 +4094,7 @@ def test_c14n_exclusion(self):
# output, not roundtripped C14N (see above).

def test_xml_c14n2(self):
datadir = findfile("c14n-20", subdir="xmltestdata")
datadir = findfile("c14n-20", subdir=("test_xml", "xmltestdata"))
full_path = partial(os.path.join, datadir)

files = [filename[:-4] for filename in sorted(os.listdir(datadir))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def test_element_with_children(self):

def install_tests():
# Test classes should have __module__ referring to this module.
from test import test_xml_etree
from test.test_xml import test_xml_etree
for name, base in vars(test_xml_etree).items():
if isinstance(base, type) and issubclass(base, unittest.TestCase):
class Temp(base):
Expand All @@ -270,7 +270,7 @@ class Temp(base):
install_tests()

def setUpModule():
from test import test_xml_etree
from test.test_xml import test_xml_etree
test_xml_etree.setUpModule(module=cET)


Expand Down
File renamed without changes.
File renamed without changes.
21 changes: 0 additions & 21 deletions Lib/test/xmltests.py

This file was deleted.

5 changes: 3 additions & 2 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -2317,8 +2317,9 @@ TESTSUBDIRS= idlelib/idle_test \
test/tokenizedata \
test/tracedmodules \
test/typinganndata \
test/xmltestdata \
test/xmltestdata/c14n-20
test/test_xml \
test/test_xml/xmltestdata \
test/test_xml/xmltestdata/c14n-20

COMPILEALL_OPTS=-j0

Expand Down