@@ -58,6 +58,13 @@ def trolley(a_trolley):
5858 return a_trolley
5959
6060
61+ @pytest .fixture
62+ def an_instance ():
63+ an_instance = Mock (spec = Instance )
64+ an_instance .data = quick_dataset (Rows = 100 )
65+ return an_instance
66+
67+
6168class NoSaveStorageDir (StorageDir ):
6269 def save (self , dataset , path = None ):
6370 """Do not actually write to disk"""
@@ -72,12 +79,6 @@ def no_storage(monkeypatch):
7279 return NoSaveStorageDir
7380
7481
75- def get_an_instance ():
76- an_instance = Mock (spec = Instance )
77- an_instance .data = quick_dataset (Rows = 100 )
78- return an_instance
79-
80-
8182def setup_namespace (namespace : Dict [str , Any ]):
8283 """All imports done before each of the examples in docs"""
8384
@@ -97,7 +98,6 @@ def setup_namespace(namespace: Dict[str, Any]):
9798 "a_session" : Mock (spec = Session ),
9899 "a_searcher" : Mock (spec = Searcher ),
99100 "a_downloader" : Mock (spec = Downloader ),
100- "an_instance" : get_an_instance (),
101101 "StudyReference" : StudyReference ,
102102 "SeriesReference" : SeriesReference ,
103103 "InstanceReference" : InstanceReference ,
@@ -111,6 +111,6 @@ def setup_namespace(namespace: Dict[str, Any]):
111111pytest_collect_file = Sybil (
112112 parsers = [PythonCodeBlockParser ()],
113113 pattern = "*.md" ,
114- fixtures = ["mock_requests" , "no_storage" , "trolley" ],
114+ fixtures = ["mock_requests" , "no_storage" , "trolley" , "an_instance" ],
115115 setup = setup_namespace ,
116116).pytest ()
0 commit comments