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
ec3c5e39
Commit
ec3c5e39
authored
Jul 30, 2006
by
Neal Norwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Verify that the signal handlers were really called
parent
c173b488
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
Lib/test/test_signal.py
Lib/test/test_signal.py
+12
-0
No files found.
Lib/test/test_signal.py
View file @
ec3c5e39
...
@@ -25,7 +25,11 @@ script = """
...
@@ -25,7 +25,11 @@ script = """
) &
) &
"""
%
vars
()
"""
%
vars
()
a_called
=
b_called
=
False
def
handlerA
(
*
args
):
def
handlerA
(
*
args
):
global
a_called
a_called
=
True
if
verbose
:
if
verbose
:
print
"handlerA"
,
args
print
"handlerA"
,
args
...
@@ -33,6 +37,8 @@ class HandlerBCalled(Exception):
...
@@ -33,6 +37,8 @@ class HandlerBCalled(Exception):
pass
pass
def
handlerB
(
*
args
):
def
handlerB
(
*
args
):
global
b_called
b_called
=
True
if
verbose
:
if
verbose
:
print
"handlerB"
,
args
print
"handlerB"
,
args
raise
HandlerBCalled
,
args
raise
HandlerBCalled
,
args
...
@@ -88,6 +94,12 @@ try:
...
@@ -88,6 +94,12 @@ try:
if
verbose
:
if
verbose
:
print
"KeyboardInterrupt (assume the alarm() went off)"
print
"KeyboardInterrupt (assume the alarm() went off)"
if
not
a_called
:
print
'HandlerA not called'
if
not
b_called
:
print
'HandlerB not called'
finally
:
finally
:
signal
.
signal
(
signal
.
SIGHUP
,
hup
)
signal
.
signal
(
signal
.
SIGHUP
,
hup
)
signal
.
signal
(
signal
.
SIGUSR1
,
usr1
)
signal
.
signal
(
signal
.
SIGUSR1
,
usr1
)
...
...
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