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
ceffda82
Commit
ceffda82
authored
Apr 16, 2012
by
Brett Cannon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #14599: Make test_reprlib robust against import cache race
conditions when regrtest is run with its -j option.
parent
de10bf4f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
Lib/test/test_reprlib.py
Lib/test/test_reprlib.py
+7
-0
No files found.
Lib/test/test_reprlib.py
View file @
ceffda82
...
...
@@ -213,6 +213,8 @@ class LongReprTest(unittest.TestCase):
# Remember where we are
self
.
here
=
os
.
getcwd
()
sys
.
path
.
insert
(
0
,
self
.
here
)
# When regrtest is run with its -j option, this command alone is not
# enough.
importlib
.
invalidate_caches
()
def
tearDown
(
self
):
...
...
@@ -233,6 +235,7 @@ class LongReprTest(unittest.TestCase):
def
test_module
(
self
):
eq
=
self
.
assertEqual
create_empty_file
(
os
.
path
.
join
(
self
.
subpkgname
,
self
.
pkgname
+
'.py'
))
importlib
.
invalidate_caches
()
from
areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation
import
areallylongpackageandmodulenametotestreprtruncation
eq
(
repr
(
areallylongpackageandmodulenametotestreprtruncation
),
"<module %r from %r>"
%
(
areallylongpackageandmodulenametotestreprtruncation
.
__name__
,
areallylongpackageandmodulenametotestreprtruncation
.
__file__
))
...
...
@@ -244,6 +247,7 @@ class LongReprTest(unittest.TestCase):
class foo(object):
pass
'''
)
importlib
.
invalidate_caches
()
from
areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation
import
foo
eq
(
repr
(
foo
.
foo
),
"<class '%s.foo'>"
%
foo
.
__name__
)
...
...
@@ -258,6 +262,7 @@ class foo(object):
class bar:
pass
'''
)
importlib
.
invalidate_caches
()
from
areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation
import
bar
# Module name may be prefixed with "test.", depending on how run.
self
.
assertEqual
(
repr
(
bar
.
bar
),
"<class '%s.bar'>"
%
bar
.
__name__
)
...
...
@@ -267,6 +272,7 @@ class bar:
class baz:
pass
'''
)
importlib
.
invalidate_caches
()
from
areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation
import
baz
ibaz
=
baz
.
baz
()
self
.
assertTrue
(
repr
(
ibaz
).
startswith
(
...
...
@@ -278,6 +284,7 @@ class baz:
class aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:
def amethod(self): pass
'''
)
importlib
.
invalidate_caches
()
from
areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation
import
qux
# Unbound methods first
r
=
repr
(
qux
.
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
.
amethod
)
...
...
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