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
04054d9a
Commit
04054d9a
authored
Feb 08, 2017
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update test_support for my temp_dir/change_cwd changes
parent
edb48814
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
6 deletions
+19
-6
Lib/test/support/__init__.py
Lib/test/support/__init__.py
+1
-1
Lib/test/test_support.py
Lib/test/test_support.py
+18
-5
No files found.
Lib/test/support/__init__.py
View file @
04054d9a
...
...
@@ -985,7 +985,7 @@ def change_cwd(path, quiet=False):
except
OSError
as
exc
:
if
not
quiet
:
raise
warnings
.
warn
(
f'tests may fail, unable to change current working '
warnings
.
warn
(
f'tests may fail, unable to change
the
current working '
f'directory to
{
path
}
:
{
exc
}
'
,
RuntimeWarning
,
stacklevel
=
3
)
try
:
...
...
Lib/test/test_support.py
View file @
04054d9a
...
...
@@ -155,8 +155,11 @@ class TestSupport(unittest.TestCase):
finally
:
shutil
.
rmtree
(
path
)
expected
=
[
'tests may fail, unable to create temp dir: '
+
path
]
self
.
assertEqual
(
warnings
,
expected
)
self
.
assertEqual
(
len
(
warnings
),
1
,
warnings
)
warn
=
warnings
[
0
]
self
.
assertTrue
(
warn
.
startswith
(
f'tests may fail, unable to create '
f'temporary directory
{
path
}
: '
),
warn
)
# Tests for change_cwd()
...
...
@@ -197,8 +200,12 @@ class TestSupport(unittest.TestCase):
self
.
assertEqual
(
os
.
getcwd
(),
new_cwd
)
warnings
=
[
str
(
w
.
message
)
for
w
in
recorder
.
warnings
]
expected
=
[
'tests may fail, unable to change CWD to: '
+
bad_dir
]
self
.
assertEqual
(
warnings
,
expected
)
self
.
assertEqual
(
len
(
warnings
),
1
,
warnings
)
warn
=
warnings
[
0
]
self
.
assertTrue
(
warn
.
startswith
(
f'tests may fail, unable to change '
f'the current working directory '
f'to
{
bad_dir
}
: '
),
warn
)
# Tests for change_cwd()
...
...
@@ -209,7 +216,13 @@ class TestSupport(unittest.TestCase):
with
support
.
change_cwd
(
path
=
path
,
quiet
=
True
):
pass
messages
=
[
str
(
w
.
message
)
for
w
in
recorder
.
warnings
]
self
.
assertEqual
(
messages
,
[
'tests may fail, unable to change CWD to: '
+
path
])
self
.
assertEqual
(
len
(
messages
),
1
,
messages
)
msg
=
messages
[
0
]
self
.
assertTrue
(
msg
.
startswith
(
f'tests may fail, unable to change '
f'the current working directory '
f'to
{
path
}
: '
),
msg
)
# Tests for temp_cwd()
...
...
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