Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ff6382b4
Commit
ff6382b4
authored
Sep 08, 2013
by
Nick Coghlan
Browse files
Options
Browse Files
Download
Plain Diff
Merge #18952 fix from 3.3
parents
68d7f787
0494c2ae
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
13 deletions
+36
-13
Doc/library/test.rst
Doc/library/test.rst
+4
-1
Lib/test/support/__init__.py
Lib/test/support/__init__.py
+19
-12
Misc/NEWS
Misc/NEWS
+13
-0
No files found.
Doc/library/test.rst
View file @
ff6382b4
...
@@ -263,12 +263,15 @@ The :mod:`test.support` module defines the following functions:
...
@@ -263,12 +263,15 @@ The :mod:`test.support` module defines the following functions:
Used when tests are executed by :mod:`test.regrtest`.
Used when tests are executed by :mod:`test.regrtest`.
.. function:: findfile(filename)
.. function:: findfile(filename
, subdir=None
)
Return the path to the file named *filename*. If no match is found
Return the path to the file named *filename*. If no match is found
*filename* is returned. This does not equal a failure since it could be the
*filename* is returned. This does not equal a failure since it could be the
path to the file.
path to the file.
Setting *subdir* indicates a relative path to use to find the file
rather than looking directly in the path directories.
.. function:: run_unittest(\*classes)
.. function:: run_unittest(\*classes)
...
...
Lib/test/support/__init__.py
View file @
ff6382b4
...
@@ -860,24 +860,31 @@ if hasattr(os, "umask"):
...
@@ -860,24 +860,31 @@ if hasattr(os, "umask"):
finally
:
finally
:
os
.
umask
(
oldmask
)
os
.
umask
(
oldmask
)
# TEST_HOME refers to the top level directory of the "test" package
# TEST_HOME
_DIR
refers to the top level directory of the "test" package
# that contains Python's regression test suite
# that contains Python's regression test suite
TEST_HOME
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
TEST_SUPPORT_DIR
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
TEST_HOME_DIR
=
os
.
path
.
dirname
(
TEST_SUPPORT_DIR
)
def
findfile
(
file
,
here
=
TEST_HOME
,
subdir
=
None
):
# TEST_DATA_DIR is used as a target download location for remote resources
TEST_DATA_DIR
=
os
.
path
.
join
(
TEST_HOME_DIR
,
"data"
)
def
findfile
(
filename
,
subdir
=
None
):
"""Try to find a file on sys.path or in the test directory. If it is not
"""Try to find a file on sys.path or in the test directory. If it is not
found the argument passed to the function is returned (this does not
found the argument passed to the function is returned (this does not
necessarily signal failure; could still be the legitimate path)."""
necessarily signal failure; could still be the legitimate path).
if
os
.
path
.
isabs
(
file
):
return
file
Setting *subdir* indicates a relative path to use to find the file
rather than looking directly in the path directories.
"""
if
os
.
path
.
isabs
(
filename
):
return
filename
if
subdir
is
not
None
:
if
subdir
is
not
None
:
file
=
os
.
path
.
join
(
subdir
,
file
)
filename
=
os
.
path
.
join
(
subdir
,
filename
)
path
=
sys
.
path
path
=
[
TEST_HOME_DIR
]
+
sys
.
path
path
=
[
os
.
path
.
dirname
(
here
)]
+
path
for
dn
in
path
:
for
dn
in
path
:
fn
=
os
.
path
.
join
(
dn
,
file
)
fn
=
os
.
path
.
join
(
dn
,
file
name
)
if
os
.
path
.
exists
(
fn
):
return
fn
if
os
.
path
.
exists
(
fn
):
return
fn
return
file
return
file
name
def
create_empty_file
(
filename
):
def
create_empty_file
(
filename
):
"""Create an empty file. If the file already exists, truncate it."""
"""Create an empty file. If the file already exists, truncate it."""
...
@@ -914,7 +921,7 @@ def open_urlresource(url, *args, **kw):
...
@@ -914,7 +921,7 @@ def open_urlresource(url, *args, **kw):
filename
=
urllib
.
parse
.
urlparse
(
url
)[
2
].
split
(
'/'
)[
-
1
]
# '/': it's URL!
filename
=
urllib
.
parse
.
urlparse
(
url
)[
2
].
split
(
'/'
)[
-
1
]
# '/': it's URL!
fn
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"data"
,
filename
)
fn
=
os
.
path
.
join
(
TEST_DATA_DIR
,
filename
)
def
check_valid_file
(
fn
):
def
check_valid_file
(
fn
):
f
=
open
(
fn
,
*
args
,
**
kw
)
f
=
open
(
fn
,
*
args
,
**
kw
)
...
...
Misc/NEWS
View file @
ff6382b4
...
@@ -2,6 +2,19 @@
...
@@ -2,6 +2,19 @@
Python
News
Python
News
+++++++++++
+++++++++++
What
's New in Python 3.4.0 Alpha 3?
===================================
Projected Release date: 2013-10-XX
Tests
-----
- Issue #18952: Fix regression in support data downloads introduced when
test.support was converted to a package. Regression noticed by Zachary
Ware.
What'
s
New
in
Python
3.4.0
Alpha
2
?
What'
s
New
in
Python
3.4.0
Alpha
2
?
===================================
===================================
...
...
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