Yelp / Testify

A more pythonic testing framework.
Other
306 stars 67 forks source link

Allow testify to be run programmatically #219

Closed dnephin closed 10 years ago

dnephin commented 10 years ago

Previously testify's main entry point was the constructor of the TestProgram class. This entry point also "returned" by calling sys.exit(). This makes it impossible to call from other code.

I've moved the main entry point to test_program.main. It still calls sys.exit() in main, but now you could call TestProgram().run() and handle the response.

My use case here is an acceptance test suite that sets up a sandbox. I would like to be able to setup the sandbox in a context manager around testify. Something like this:

with sandbox():
    result = TestProgram().run()
milki commented 10 years ago

lgtm. I like your use case too.