abalakh / airgun

Airgun moved to https://github.com/SatelliteQE/airgun
https://github.com/SatelliteQE/airgun
1 stars 2 forks source link

Lazy entities init #25

Open abalakh opened 6 years ago

abalakh commented 6 years ago

This feature was requested by @omaciel during PoC demo. Entities initialization do not have any logic and do not perform any calculations, that's why we decided to init all of them inside session - to have nice shortcut and ability to call any entity's helper without the need to explicitly import them in tests. However, since majority of tests will only use just few entities and definitely not all of them - we should probably think of lazy init.

Few ideas off the top of my head:

  1. (preferable) Use cached_property for entities initialization.
  2. Write our own implementation of simple cache, probably on top of regular properties
  3. (last resort) Write custom __getattr__() which will init entity. Definitely a bad practice and rather a hack.