MCPcopy
hub / github.com/HelloZeroNet/ZeroNet / site_temp

Function site_temp

src/Test/conftest.py:200–215  ·  view source on GitHub ↗
(request)

Source from the content-addressed store, hash-verified

198
199@pytest.fixture()
200def site_temp(request):
201 threads_before = [obj for obj in gc.get_objects() if isinstance(obj, gevent.Greenlet)]
202 with mock.patch("Config.config.data_dir", config.data_dir + "-temp"):
203 site_temp = Site("1TeSTvb4w2PWE81S2rEELgmX2GCCExQGT")
204 site_temp.announce = mock.MagicMock(return_value=True) # Don't try to find peers from the net
205
206 def cleanup():
207 site_temp.storage.deleteFiles()
208 site_temp.content_manager.contents.db.deleteSite(site_temp)
209 site_temp.content_manager.contents.db.close()
210 db_path = "%s-temp/content.db" % config.data_dir
211 os.unlink(db_path)
212 del ContentDb.content_dbs[db_path]
213 gevent.killall([obj for obj in gc.get_objects() if isinstance(obj, gevent.Greenlet) and obj not in threads_before])
214 request.addfinalizer(cleanup)
215 return site_temp
216
217
218@pytest.fixture(scope="session")

Callers

nothing calls this directly

Calls 1

SiteClass · 0.90

Tested by

no test coverage detected