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
f6365e01
Commit
f6365e01
authored
Aug 16, 2001
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a test for module repr truncation when the package name is
really long. Closes SF bug #437984.
parent
501c7c7d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
Lib/test/test_import.py
Lib/test/test_import.py
+35
-0
No files found.
Lib/test/test_import.py
View file @
f6365e01
...
...
@@ -69,3 +69,38 @@ try:
test_with_extension
(
ext
)
finally
:
del
sys
.
path
[
0
]
def
touch
(
path
):
fp
=
open
(
path
,
'w'
)
fp
.
close
()
# test imports of packages with really long names, but specifically that their
# reprs include the full name
try
:
longname
=
'areallylongpackageandmodulenametotestreprtruncation'
os
.
mkdir
(
longname
)
touch
(
os
.
path
.
join
(
longname
,
'__init__.py'
))
os
.
mkdir
(
os
.
path
.
join
(
longname
,
longname
))
touch
(
os
.
path
.
join
(
longname
,
longname
,
'__init__.py'
))
touch
(
os
.
path
.
join
(
longname
,
longname
,
longname
+
'.py'
))
sys
.
path
.
insert
(
0
,
os
.
getcwd
())
from
areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation
import
areallylongpackageandmodulenametotestreprtruncation
if
`areallylongpackageandmodulenametotestreprtruncation`
<>
\
"<module 'areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation' from '%s'>"
%
areallylongpackageandmodulenametotestreprtruncation
.
__file__
:
raise
TestFailed
,
'module name truncation'
finally
:
# Delete recursively
del
sys
.
path
[
0
]
def
zap
(
actions
,
dirname
,
names
):
for
name
in
names
:
actions
.
append
(
os
.
path
.
join
(
dirname
,
name
))
actions
=
[]
os
.
path
.
walk
(
longname
,
zap
,
actions
)
actions
.
append
(
longname
)
actions
.
sort
()
actions
.
reverse
()
for
p
in
actions
:
if
os
.
path
.
isdir
(
p
):
os
.
rmdir
(
p
)
else
:
os
.
remove
(
p
)
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