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
aca5fa70
Commit
aca5fa70
authored
Jan 12, 2011
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make test skipping message nicer, and remove the rather useless "overhead" parameter.
parent
219c3007
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
20 deletions
+10
-20
Lib/test/support.py
Lib/test/support.py
+10
-20
No files found.
Lib/test/support.py
View file @
aca5fa70
...
@@ -978,13 +978,12 @@ def set_memlimit(limit):
...
@@ -978,13 +978,12 @@ def set_memlimit(limit):
raise
ValueError
(
'Memory limit %r too low to be useful'
%
(
limit
,))
raise
ValueError
(
'Memory limit %r too low to be useful'
%
(
limit
,))
max_memuse
=
memlimit
max_memuse
=
memlimit
def
bigmemtest
(
minsize
,
memuse
,
overhead
=
5
*
_1M
):
def
bigmemtest
(
minsize
,
memuse
):
"""Decorator for bigmem tests.
"""Decorator for bigmem tests.
'minsize' is the minimum useful size for the test (in arbitrary,
'minsize' is the minimum useful size for the test (in arbitrary,
test-interpreted units.) 'memuse' is the number of 'bytes per size' for
test-interpreted units.) 'memuse' is the number of 'bytes per size' for
the test, or a good estimate of it. 'overhead' specifies fixed overhead,
the test, or a good estimate of it.
independent of the testsize, and defaults to 5Mb.
The decorator tries to guess a good value for 'size' and passes it to
The decorator tries to guess a good value for 'size' and passes it to
the decorated test function. If minsize * memuse is more than the
the decorated test function. If minsize * memuse is more than the
...
@@ -996,7 +995,6 @@ def bigmemtest(minsize, memuse, overhead=5*_1M):
...
@@ -996,7 +995,6 @@ def bigmemtest(minsize, memuse, overhead=5*_1M):
# Retrieve values in case someone decided to adjust them
# Retrieve values in case someone decided to adjust them
minsize
=
wrapper
.
minsize
minsize
=
wrapper
.
minsize
memuse
=
wrapper
.
memuse
memuse
=
wrapper
.
memuse
overhead
=
wrapper
.
overhead
if
not
max_memuse
:
if
not
max_memuse
:
# If max_memuse is 0 (the default),
# If max_memuse is 0 (the default),
# we still want to run the tests with size set to a few kb,
# we still want to run the tests with size set to a few kb,
...
@@ -1005,43 +1003,35 @@ def bigmemtest(minsize, memuse, overhead=5*_1M):
...
@@ -1005,43 +1003,35 @@ def bigmemtest(minsize, memuse, overhead=5*_1M):
maxsize
=
5147
maxsize
=
5147
self
.
assertFalse
(
maxsize
*
memuse
+
overhead
>
20
*
_1M
)
self
.
assertFalse
(
maxsize
*
memuse
+
overhead
>
20
*
_1M
)
else
:
else
:
maxsize
=
int
(
(
max_memuse
-
overhead
)
/
memuse
)
maxsize
=
int
(
max_memuse
/
memuse
)
if
maxsize
<
minsize
:
if
maxsize
<
minsize
:
# Really ought to print 'test skipped' or something
raise
unittest
.
SkipTest
(
if
verbose
:
"not enough memory: %.1fG minimum needed"
sys
.
stderr
.
write
(
"Skipping %s because of memory "
%
(
minsize
*
memuse
/
(
1024
**
3
)))
"constraint
\
n
"
%
(
f
.
__name__
,))
return
# Try to keep some breathing room in memory use
maxsize
=
max
(
maxsize
-
50
*
_1M
,
minsize
)
return
f
(
self
,
maxsize
)
return
f
(
self
,
maxsize
)
wrapper
.
minsize
=
minsize
wrapper
.
minsize
=
minsize
wrapper
.
memuse
=
memuse
wrapper
.
memuse
=
memuse
wrapper
.
overhead
=
overhead
return
wrapper
return
wrapper
return
decorator
return
decorator
def
precisionbigmemtest
(
size
,
memuse
,
overhead
=
5
*
_1M
):
def
precisionbigmemtest
(
size
,
memuse
):
def
decorator
(
f
):
def
decorator
(
f
):
def
wrapper
(
self
):
def
wrapper
(
self
):
size
=
wrapper
.
size
size
=
wrapper
.
size
memuse
=
wrapper
.
memuse
memuse
=
wrapper
.
memuse
overhead
=
wrapper
.
overhead
if
not
real_max_memuse
:
if
not
real_max_memuse
:
maxsize
=
5147
maxsize
=
5147
else
:
else
:
maxsize
=
size
maxsize
=
size
if
real_max_memuse
and
real_max_memuse
<
maxsize
*
memuse
:
if
real_max_memuse
and
real_max_memuse
<
maxsize
*
memuse
:
if
verbose
:
raise
unittest
.
SkipTest
(
sys
.
stderr
.
write
(
"Skipping %s because of memory "
"not enough memory: %.1fG minimum needed"
"constraint
\
n
"
%
(
f
.
__name__
,))
%
(
size
*
memuse
/
(
1024
**
3
)))
return
return
f
(
self
,
maxsize
)
return
f
(
self
,
maxsize
)
wrapper
.
size
=
size
wrapper
.
size
=
size
wrapper
.
memuse
=
memuse
wrapper
.
memuse
=
memuse
wrapper
.
overhead
=
overhead
return
wrapper
return
wrapper
return
decorator
return
decorator
...
...
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