我做了一個基本包,以方便在金字塔應用程序中使用SQLAlchemy:pyramid_sqlalchemy。當你使用這個軟件包爲應用程序編寫測試時,你將需要一些固件來提供一個工作的數據庫環境。這些固定裝置是完全通用的,不需要爲應用程序定製。此時這些燈具列在testing chapter of the documentation中,並要求人們複製&將它們粘貼到其代碼中。毋庸置疑,這並不理想。創建可重用的py.text燈具
是否有pyramid_sqlalchemy一個簡單的方法來公開這些燈具在某種程度上其它軟件包可以直接使用它們?我嘗試了一種天真的方法,創建一個包含所有燈具的pyramid_sqlalchemy.fixtures模塊,並在應用測試的conftest.py
中執行from pyramid_sqlalchemy.fixtures import *
,但這並未導致燈具被拾取。