File tree Expand file tree Collapse file tree 3 files changed +278
-274
lines changed Expand file tree Collapse file tree 3 files changed +278
-274
lines changed Original file line number Diff line number Diff line change 5
5
import logging
6
6
7
7
from functools import lru_cache
8
+ import diffpy .srfit .equation .literals as literals
9
+ from diffpy .srfit .sas .sasimport import sasimport
10
+
8
11
9
12
logger = logging .getLogger (__name__ )
10
13
@@ -92,3 +95,31 @@ def datafile():
92
95
def _datafile (filename ):
93
96
return importlib .resources .files ("diffpy.srfit.tests.testdata" ).joinpath (filename )
94
97
return _datafile
98
+
99
+ @pytest .fixture (scope = "session" )
100
+ def make_args ():
101
+ def _makeArgs (num ):
102
+ args = []
103
+ for i in range (num ):
104
+ j = i + 1
105
+ args .append (literals .Argument (name = "v%i" % j , value = j ))
106
+ return args
107
+ return _makeArgs
108
+
109
+ @pytest .fixture (scope = "session" )
110
+ def noObserversInGlobalBuilders ():
111
+ def _noObserversInGlobalBuilders ():
112
+ """True if no observer function leaks to global builder objects.
113
+
114
+ Ensure objects are not immortal due to a reference from static
115
+ value.
116
+ """
117
+ from diffpy .srfit .equation .builder import _builders
118
+
119
+ rv = True
120
+ for n , b in _builders .items ():
121
+ if b .literal and b .literal ._observers :
122
+ rv = False
123
+ break
124
+ return rv
125
+ return _noObserversInGlobalBuilders ()
You can’t perform that action at this time.
0 commit comments