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
c3b0757b
Commit
c3b0757b
authored
Nov 13, 2009
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Silence getcheckinterval()-related warnings in the test suite
parent
589c2d39
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
10 deletions
+11
-10
Lib/test/test_sys.py
Lib/test/test_sys.py
+8
-5
Lib/test/test_threading.py
Lib/test/test_threading.py
+3
-5
No files found.
Lib/test/test_sys.py
View file @
c3b0757b
...
@@ -4,6 +4,7 @@ import sys, io, os
...
@@ -4,6 +4,7 @@ import sys, io, os
import
struct
import
struct
import
subprocess
import
subprocess
import
textwrap
import
textwrap
import
warnings
# count the number of test runs, used to create unique
# count the number of test runs, used to create unique
# strings to intern in test_intern()
# strings to intern in test_intern()
...
@@ -148,11 +149,13 @@ class SysModuleTest(unittest.TestCase):
...
@@ -148,11 +149,13 @@ class SysModuleTest(unittest.TestCase):
# testing sys.setprofile() is done in test_profile.py
# testing sys.setprofile() is done in test_profile.py
def
test_setcheckinterval
(
self
):
def
test_setcheckinterval
(
self
):
self
.
assertRaises
(
TypeError
,
sys
.
setcheckinterval
)
with
warnings
.
catch_warnings
():
orig
=
sys
.
getcheckinterval
()
warnings
.
simplefilter
(
"ignore"
)
for
n
in
0
,
100
,
120
,
orig
:
# orig last to restore starting state
self
.
assertRaises
(
TypeError
,
sys
.
setcheckinterval
)
sys
.
setcheckinterval
(
n
)
orig
=
sys
.
getcheckinterval
()
self
.
assertEquals
(
sys
.
getcheckinterval
(),
n
)
for
n
in
0
,
100
,
120
,
orig
:
# orig last to restore starting state
sys
.
setcheckinterval
(
n
)
self
.
assertEquals
(
sys
.
getcheckinterval
(),
n
)
def
test_switchinterval
(
self
):
def
test_switchinterval
(
self
):
self
.
assertRaises
(
TypeError
,
sys
.
setswitchinterval
)
self
.
assertRaises
(
TypeError
,
sys
.
setswitchinterval
)
...
...
Lib/test/test_threading.py
View file @
c3b0757b
...
@@ -342,12 +342,10 @@ class ThreadTests(BaseTestCase):
...
@@ -342,12 +342,10 @@ class ThreadTests(BaseTestCase):
# Try hard to trigger #1703448: a thread is still returned in
# Try hard to trigger #1703448: a thread is still returned in
# threading.enumerate() after it has been join()ed.
# threading.enumerate() after it has been join()ed.
enum = threading.enumerate
enum = threading.enumerate
old_interval = sys.get
check
interval()
old_interval = sys.get
switch
interval()
try:
try:
for i in range(1, 100):
for i in range(1, 100):
# Try a couple times at each thread-switching interval
sys.setswitchinterval(i * 0.0002)
# to get more interleavings.
sys.setcheckinterval(i // 5)
t = threading.Thread(target=lambda: None)
t = threading.Thread(target=lambda: None)
t.start()
t.start()
t.join()
t.join()
...
@@ -355,7 +353,7 @@ class ThreadTests(BaseTestCase):
...
@@ -355,7 +353,7 @@ class ThreadTests(BaseTestCase):
self.assertFalse(t in l,
self.assertFalse(t in l,
"
#1703448 triggered after %d trials: %s" % (i, l))
"
#1703448 triggered after %d trials: %s" % (i, l))
finally
:
finally
:
sys
.
set
check
interval
(
old_interval
)
sys
.
set
switch
interval
(
old_interval
)
def
test_no_refcycle_through_target
(
self
):
def
test_no_refcycle_through_target
(
self
):
class
RunSelfFunction
(
object
):
class
RunSelfFunction
(
object
):
...
...
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