Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sakia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sébastien DA ROCHA
sakia
Commits
ccb11979
Commit
ccb11979
authored
8 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Fix tests
parent
556665f3
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/sakia/core/net/node.py
+3
-3
3 additions, 3 deletions
src/sakia/core/net/node.py
src/sakia/tests/mocks/server.py
+7
-7
7 additions, 7 deletions
src/sakia/tests/mocks/server.py
src/sakia/tests/quamash_utils.py
+1
-0
1 addition, 0 deletions
src/sakia/tests/quamash_utils.py
with
11 additions
and
10 deletions
src/sakia/core/net/node.py
+
3
−
3
View file @
ccb11979
...
...
@@ -11,7 +11,7 @@ from ...tools.decorators import asyncify
from
duniterpy.api
import
bma
,
errors
from
duniterpy.api.bma
import
ConnectionHandler
from
aiohttp.errors
import
WSClientDisconnectedError
,
WSServerHandshakeError
,
ClientResponseError
from
aiohttp.errors
import
WSServerHandshakeError
,
ClientResponseError
from
aiohttp.errors
import
ClientError
,
DisconnectedError
from
asyncio
import
TimeoutError
import
logging
...
...
@@ -367,7 +367,7 @@ class Node(QObject):
break
elif
msg
.
tp
==
aiohttp
.
MsgType
.
error
:
break
except
(
WSServerHandshakeError
,
WSClientDisconnectedError
,
ClientResponseError
,
ValueError
)
as
e
:
except
(
WSServerHandshakeError
,
ClientResponseError
,
ValueError
)
as
e
:
logging
.
debug
(
"
Websocket block {0} : {1} - {2}
"
.
format
(
type
(
e
).
__name__
,
str
(
e
),
self
.
pubkey
[:
5
]))
await
self
.
request_current_block
()
except
(
ClientError
,
gaierror
,
TimeoutError
,
DisconnectedError
)
as
e
:
...
...
@@ -566,7 +566,7 @@ class Node(QObject):
break
elif
msg
.
tp
==
aiohttp
.
MsgType
.
error
:
break
except
(
WSServerHandshakeError
,
WSClientDisconnectedError
,
ClientResponseError
,
ValueError
)
as
e
:
except
(
WSServerHandshakeError
,
ClientResponseError
,
ValueError
)
as
e
:
logging
.
debug
(
"
Websocket peer {0} : {1} - {2}
"
.
format
(
type
(
e
).
__name__
,
str
(
e
),
self
.
pubkey
[:
5
]))
await
self
.
request_peers
()
except
(
ClientError
,
gaierror
,
TimeoutError
,
DisconnectedError
)
as
e
:
...
...
This diff is collapsed.
Click to expand it.
src/sakia/tests/mocks/server.py
+
7
−
7
View file @
ccb11979
...
...
@@ -44,12 +44,7 @@ class MockServer():
self
.
requests
=
[]
self
.
app
=
web
.
Application
(
loop
=
self
.
lp
,
middlewares
=
[
self
.
middleware_factory
])
self
.
handler
=
self
.
app
.
make_handler
(
keep_alive_on
=
False
,
access_log
=
log
.
access_logger
,
)
self
.
handler
=
None
self
.
port
=
self
.
find_unused_port
()
def
get_request
(
self
,
i
):
...
...
@@ -90,12 +85,17 @@ class MockServer():
return
peer_document_generator
(
self
.
port
)
async
def
create_server
(
self
,
ssl_ctx
=
None
):
srv
=
await
self
.
lp
.
create_server
(
self
.
handler
,
'
127.0.0.1
'
,
self
.
port
)
protocol
=
"
https
"
if
ssl_ctx
else
"
http
"
url
=
"
{}://127.0.0.1:{}
"
.
format
(
protocol
,
self
.
port
)
self
.
add_route
(
'
GET
'
,
'
/network/peering
'
,
bma_peering_generator
(
self
.
port
))
self
.
handler
=
self
.
app
.
make_handler
(
keep_alive_on
=
False
,
access_log
=
log
.
access_logger
,
)
srv
=
await
self
.
lp
.
create_server
(
self
.
handler
,
'
127.0.0.1
'
,
self
.
port
)
return
srv
,
self
.
port
,
url
async
def
close
(
self
):
...
...
This diff is collapsed.
Click to expand it.
src/sakia/tests/quamash_utils.py
+
1
−
0
View file @
ccb11979
...
...
@@ -10,6 +10,7 @@ class QuamashTest:
def
setUpQuamash
(
self
):
self
.
qapplication
=
get_application
()
self
.
lp
=
quamash
.
QSelectorEventLoop
(
self
.
qapplication
)
self
.
qapplication
.
setQuitOnLastWindowClosed
(
False
)
asyncio
.
set_event_loop
(
self
.
lp
)
self
.
lp
.
set_exception_handler
(
lambda
l
,
c
:
unitttest_exception_handler
(
self
,
l
,
c
))
self
.
exceptions
=
[]
...
...
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