Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bliss
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alisher Gaibulaev
bliss
Commits
32001140
Commit
32001140
authored
4 years ago
by
Linus Pithan
Committed by
Linus Pithan
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[killing scans] some tests that are failing
parent
add2872c
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/scans/test_exception.py
+150
-0
150 additions, 0 deletions
tests/scans/test_exception.py
with
150 additions
and
0 deletions
tests/scans/test_exception.py
+
150
−
0
View file @
32001140
...
...
@@ -230,3 +230,153 @@ def test_exception_in_start_and_stop_and_preset(session, first_iteration, preset
assert
isinstance
(
e
,
ZeroDivisionError
)
else
:
assert
False
class
EverMovingAxis
:
def
__init__
(
self
):
self
.
_position
=
0
@property
def
position
(
self
):
return
self
.
_position
@position.setter
def
position
(
self
,
value
):
i
=
1
while
True
:
print
(
f
"
\r
{
i
}
"
,
end
=
""
)
i
+=
1
gevent
.
sleep
(.
1
)
def
test_scan_kill_during_pepare
(
default_session
):
diode
=
default_session
.
config
.
get
(
"
diode
"
)
ax
=
SoftAxis
(
"
TestAxis
"
,
EverMovingAxis
())
# ~ with gevent.Timeout(1):
# ~ scans.ascan(ax,1,2,3,.1,diode,save=False)
s
=
scans
.
ascan
(
ax
,
1
,
2
,
3
,
.
1
,
diode
,
save
=
False
,
run
=
False
)
g
=
gevent
.
spawn
(
s
.
run
)
gevent
.
sleep
(
1
)
print
(
"
greenlet kill
"
)
g
.
kill
(
block
=
False
)
# g.kill()
gevent
.
sleep
(
1
)
assert
g
.
successful
()
## is g.successful a good test to do?
def
test_scan_kill_during_pepare_timeout
(
default_session
):
diode
=
default_session
.
config
.
get
(
"
diode
"
)
ax
=
SoftAxis
(
"
TestAxis
"
,
EverMovingAxis
())
# ~ with gevent.Timeout(1):
# ~ scans.ascan(ax,1,2,3,.1,diode,save=False)
s
=
scans
.
ascan
(
ax
,
1
,
2
,
3
,
.
1
,
diode
,
save
=
False
,
run
=
False
)
g
=
gevent
.
spawn
(
s
.
run
)
gevent
.
sleep
(
1
)
print
(
"
send gevent.Timeout
"
)
g
.
kill
(
gevent
.
Timeout
,
block
=
False
)
gevent
.
sleep
(
1
)
assert
g
.
successful
()
def
test_scan_kill_during_pepare_greenlet
(
default_session
):
diode
=
default_session
.
config
.
get
(
"
diode
"
)
ax
=
SoftAxis
(
"
TestAxis
"
,
EverMovingAxis
())
s
=
scans
.
ascan
(
ax
,
1
,
2
,
3
,
.
1
,
diode
,
save
=
False
,
run
=
False
)
def
foo
(
s
):
with
gevent
.
Timeout
(.
5
):
s
.
run
()
g
=
gevent
.
spawn
(
foo
,
s
)
gevent
.
sleep
(
1
)
assert
s
.
state
.
name
==
"
DONE
"
# needs to be changed to KILLED soon
g
.
kill
()
assert
s
.
state
.
name
==
"
DONE
"
# needs to be changed to KILLED soon
def
test_scan_kill_during_pepare_keyboardinterrupt
(
default_session
):
diode
=
default_session
.
config
.
get
(
"
diode
"
)
ax
=
SoftAxis
(
"
TestAxis
"
,
EverMovingAxis
())
s
=
scans
.
ascan
(
ax
,
1
,
2
,
3
,
.
1
,
diode
,
save
=
False
,
run
=
False
)
g
=
gevent
.
spawn
(
s
.
run
)
gevent
.
sleep
(
1
)
print
(
"
send KeyboardInterrupt
"
)
g
.
kill
(
KeyboardInterrupt
,
block
=
False
)
gevent
.
sleep
(
1
)
assert
g
.
successful
()
class
EverMovingAxis2
:
def
__init__
(
self
):
self
.
_position
=
0
@property
def
position
(
self
):
return
self
.
_position
@position.setter
def
position
(
self
,
value
):
if
value
<
1
:
self
.
_postion
=
value
return
i
=
1
while
True
:
print
(
f
"
\r
{
i
}
"
,
end
=
""
)
i
+=
1
gevent
.
sleep
(.
1
)
def
test_scan_kill_during_running_keyboardinterrupt
(
default_session
):
diode
=
default_session
.
config
.
get
(
"
diode
"
)
ax
=
SoftAxis
(
"
TestAxis
"
,
EverMovingAxis2
())
s
=
scans
.
ascan
(
ax
,
1
,
2
,
3
,
.
1
,
diode
,
save
=
False
,
run
=
False
)
g
=
gevent
.
spawn
(
s
.
run
)
gevent
.
sleep
(
1
)
print
(
"
send KeyboardInterrupt
"
)
g
.
kill
(
KeyboardInterrupt
,
block
=
False
)
gevent
.
sleep
(
1
)
assert
g
.
successful
()
class
EverMovingAxis3
:
def
__init__
(
self
):
self
.
_position
=
0
self
.
_stop_flag
=
False
@property
def
position
(
self
):
return
self
.
_position
@position.setter
def
position
(
self
,
value
):
self
.
_stop_flag
=
False
i
=
1
while
not
self
.
_stop_flag
:
print
(
f
"
\r
{
i
}
"
,
end
=
""
)
i
+=
1
gevent
.
sleep
(
0
)
def
stop
(
self
):
self
.
_stop_flag
=
True
def
test_scan_kill_keyboardinterrupt_with_stop
(
default_session
):
diode
=
default_session
.
config
.
get
(
"
diode
"
)
ax
=
SoftAxis
(
"
TestAxis
"
,
EverMovingAxis3
(),
stop
=
"
stop
"
)
s
=
scans
.
ascan
(
ax
,
1
,
2
,
3
,
.
1
,
diode
,
save
=
False
,
run
=
False
)
g
=
gevent
.
spawn
(
s
.
run
)
gevent
.
sleep
(
1
)
print
(
"
send KeyboardInterrupt
"
)
with
pytest
.
raises
(
KeyboardInterrupt
):
g
.
kill
(
KeyboardInterrupt
,
block
=
False
)
gevent
.
sleep
(
1
)
assert
g
.
successful
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment