开发者

How to setup web2py fixtures

开发者 https://www.devze.com 2023-01-11 23:32 出处:网络
I\'m trying to find a way to create fixtures for my web2py application. I came across http://thadeusb.com/weblog/2010/4/21/using_fixtures_in_web2py that suggests creating ax_fixtures.py file to place

I'm trying to find a way to create fixtures for my web2py application. I came across http://thadeusb.com/weblog/2010/4/21/using_fixtures_in_web2py that suggests creating a x_fixtures.py file to place all the fixtures in. The problem is that after a while, the file gets huge and a pain to navigate through.

What I want to be able to do is have a folder named fixtures/ and place all my fixtures in separate files named after the table they're for.

The Official Web2py Book says "tests is a directory for storing te开发者_如何转开发st scripts, fixtures and mocks.", but I haven't been able to get that to work either. The project didn't have a tests directory by default, so I had to create one.

Has anyone setup fixtures in this way using web2py before? If not, any suggestions on what to try next?


Well, I couldn't figure out how to get the fixtures to work while in the directory I created web2py/applications/MyApp/tests/fixtures, but I did get fixtures to work how I wanted by simply creating a web2py/applications/MyApp/models/fixtures directory and placing a separate file for each table I want fixtures for following the pattern of x_fixtures_TABLE_NAME.py.

0

精彩评论

暂无评论...
验证码 换一张
取 消