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
77cd2585
Commit
77cd2585
authored
Dec 08, 2011
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented suggested improvements for pdb test by Éric Araujo
parent
2bc1e8fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
18 deletions
+19
-18
Lib/test/test_pdb.py
Lib/test/test_pdb.py
+19
-18
No files found.
Lib/test/test_pdb.py
View file @
77cd2585
...
...
@@ -280,35 +280,36 @@ def test_pdb_continue_in_bottomframe():
4
"""
class
Tester7750
(
unittest
.
TestCase
):
# if the filename has something that resolves to a python
# escape character (such as \t), it will fail
test_fn
=
'.
\
\
test7750.py'
msg
=
"issue7750 only applies when os.sep is a backslash"
@
unittest
.
skipUnless
(
os
.
path
.
sep
==
'
\
\
'
,
msg
)
def
test_issue7750
(
self
):
with
open
(
self
.
test_fn
,
'w'
)
as
f
:
f
.
write
(
'print("hello world")'
)
cmd
=
[
sys
.
executable
,
'-m'
,
'pdb'
,
self
.
test_fn
,]
class
ModuleInitTester
(
unittest
.
TestCase
):
def
test_filename_correct
(
self
):
"""
In issue 7750, it was found that if the filename has a sequence that
resolves to an escape character in a Python string (such as
\
t
), it
will be treated as the escaped character.
"""
# the test_fn must contain something like \t
# on Windows, this will create 'test_mod.py' in the current directory.
# on Unix, this will create '.\test_mod.py' in the current directory.
test_fn
=
'.
\
\
test_mod.py'
code
=
'print("testing pdb")'
with
open
(
test_fn
,
'w'
)
as
f
:
f
.
write
(
code
)
self
.
addCleanup
(
os
.
remove
,
test_fn
)
cmd
=
[
sys
.
executable
,
'-m'
,
'pdb'
,
test_fn
,]
proc
=
subprocess
.
Popen
(
cmd
,
stdout
=
subprocess
.
PIPE
,
stdin
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
,
)
stdout
,
stderr
=
proc
.
communicate
(
'quit
\
n
'
)
self
.
assertNotIn
(
'IOError'
,
stdout
,
"pdb munged the filename"
)
def
tearDown
(
self
):
if
os
.
path
.
isfile
(
self
.
test_fn
):
os
.
remove
(
self
.
test_fn
)
self
.
assertIn
(
code
,
stdout
,
"pdb munged the filename"
)
def
test_main
():
from
test
import
test_pdb
test_support
.
run_doctest
(
test_pdb
,
verbosity
=
True
)
test_support
.
run_unittest
(
ModuleInitTester
)
if
__name__
==
'__main__'
:
test_main
()
unittest
.
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