Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
flamenco-worker-python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
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
blender
flamenco-worker-python
Commits
6ad48a1e
Commit
6ad48a1e
authored
6 years ago
by
Sybren A. Stüvel
Browse files
Options
Downloads
Patches
Plain Diff
Disconnect from SQLite DB when tearing down tests
This allows the temp directory to be cleaned up on Windows.
parent
279388e3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
flamenco_worker/upstream_update_queue.py
+4
-0
4 additions, 0 deletions
flamenco_worker/upstream_update_queue.py
tests/test_upstream_update_queue.py
+5
-0
5 additions, 0 deletions
tests/test_upstream_update_queue.py
with
9 additions
and
0 deletions
flamenco_worker/upstream_update_queue.py
+
4
−
0
View file @
6ad48a1e
...
@@ -46,6 +46,8 @@ class TaskUpdateQueue:
...
@@ -46,6 +46,8 @@ class TaskUpdateQueue:
self
.
_db
.
isolation_level
=
''
self
.
_db
.
isolation_level
=
''
def
_disconnect_db
(
self
):
def
_disconnect_db
(
self
):
if
self
.
_db
is
None
:
return
self
.
_log
.
info
(
'
Disconnecting from database %s
'
,
self
.
db_fname
)
self
.
_log
.
info
(
'
Disconnecting from database %s
'
,
self
.
db_fname
)
self
.
_db
.
close
()
self
.
_db
.
close
()
self
.
_db
=
None
self
.
_db
=
None
...
@@ -91,6 +93,8 @@ class TaskUpdateQueue:
...
@@ -91,6 +93,8 @@ class TaskUpdateQueue:
self
.
_log
.
debug
(
'
Inspecting queued task updates.
'
)
self
.
_log
.
debug
(
'
Inspecting queued task updates.
'
)
await
self
.
flush_and_catch
(
loop
=
loop
)
await
self
.
flush_and_catch
(
loop
=
loop
)
self
.
_disconnect_db
()
self
.
_log
.
warning
(
'
Stopping work loop
'
)
self
.
_log
.
warning
(
'
Stopping work loop
'
)
def
_queue
(
self
)
->
typing
.
Iterable
[
typing
.
Tuple
[
int
,
str
,
object
]]:
def
_queue
(
self
)
->
typing
.
Iterable
[
typing
.
Tuple
[
int
,
str
,
object
]]:
...
...
This diff is collapsed.
Click to expand it.
tests/test_upstream_update_queue.py
+
5
−
0
View file @
6ad48a1e
import
asyncio
import
asyncio
import
copy
import
copy
import
datetime
import
datetime
import
logging
import
tempfile
import
tempfile
from
unittest.mock
import
Mock
from
unittest.mock
import
Mock
...
@@ -16,6 +17,8 @@ class TaskUpdateQueueTest(AbstractWorkerTest):
...
@@ -16,6 +17,8 @@ class TaskUpdateQueueTest(AbstractWorkerTest):
from
flamenco_worker.cli
import
construct_asyncio_loop
from
flamenco_worker.cli
import
construct_asyncio_loop
from
tests.mock_responses
import
CoroMock
from
tests.mock_responses
import
CoroMock
logging
.
getLogger
(
'
flamenco_worker.upstream_update_queue
'
).
setLevel
(
logging
.
DEBUG
)
self
.
asyncio_loop
=
construct_asyncio_loop
()
self
.
asyncio_loop
=
construct_asyncio_loop
()
self
.
shutdown_future
=
self
.
asyncio_loop
.
create_future
()
self
.
shutdown_future
=
self
.
asyncio_loop
.
create_future
()
...
@@ -31,6 +34,8 @@ class TaskUpdateQueueTest(AbstractWorkerTest):
...
@@ -31,6 +34,8 @@ class TaskUpdateQueueTest(AbstractWorkerTest):
)
)
def
tearDown
(
self
):
def
tearDown
(
self
):
self
.
tuqueue
.
_disconnect_db
()
super
().
tearDown
()
self
.
tmpdir
.
cleanup
()
self
.
tmpdir
.
cleanup
()
def
test_queue_push
(
self
):
def
test_queue_push
(
self
):
...
...
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