Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
96df97a0
Commit
96df97a0
authored
Apr 01, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e2dc8651
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletion
+27
-1
conftest.py
conftest.py
+22
-0
lib/testing.py
lib/testing.py
+5
-1
No files found.
conftest.py
View file @
96df97a0
...
...
@@ -20,10 +20,32 @@
from
__future__
import
print_function
,
absolute_import
import
pytest
import
transaction
from
golang
import
func
,
defer
from
functools
import
partial
import
gc
# reset transaction synchronizers before every test run.
#
# This isolates different tests from each other. When there is failure in test A,
# and it is not careful enough to close all ZODB Connections (but DB and
# storage are closed), those connections will continue to participate in
# transaction boundaries, and crash on access to closed storage.
#
# Fix it once and for all in one place here.
# It would be more easy if DB.close would call conn.close for all its opened
# connections, but unfortunately it is not the case.
#
# See also TestDB_Base.teardown, but it isolates only module Ma from module Mb,
# not test M.A from test M.B.
@
pytest
.
fixture
(
autouse
=
True
)
def
transaction_reset
():
transaction
.
manager
.
clearSynchs
()
yield
# nothing to run after test
# Before pytest exits, teardown WCFS(s) that we automatically spawned during
# test runs in bigfile/bigarray/...
#
...
...
lib/testing.py
View file @
96df97a0
# Wendelin. Testing utilities
# Copyright (C) 2014-202
0
Nexedi SA and Contributors.
# Copyright (C) 2014-202
1
Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com>
#
# This program is free software: you can Use, Study, Modify and Redistribute
...
...
@@ -204,6 +204,10 @@ class TestDB_Base(object):
def
teardown
(
self
):
# close connections that test code forgot to close
#
# see also conftest.transaction_reset(), which tries to isolate all
# tests from each other. (TestDB_Base.teardown - on the other hand - is
# invoked per module and so isolates at module-level only)
for
connref
,
tb
in
self
.
connv
:
conn
=
connref
()
if
conn
is
None
:
...
...
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