← Back to team overview

launchpad-dev team mailing list archive

New "sampledata" module

 

Hello everyone,

There is now an lp.testing.sampledata module in the tree. Whenever you
come across a test that uses a literal string or a literal integer to
refer to sampledata, please define the literal as a constant in
lp.testing.sampledata and use the constant instead.

e.g. Instead of:
  login('foo.bar@xxxxxxxxxxxxx') # This is bad. Magic strings are bad.

Use:
  login(ADMIN_USER_EMAIL) # Constants with intent-revealing names are good

In addition to the improved clarity, using this module will make it
easier for us to identify the tests that use sampledata and make them
stop.

jml