[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GMG-Devel] Some changes to the way tests are written

From: Christopher Allan Webber
Subject: [GMG-Devel] Some changes to the way tests are written
Date: Fri, 05 Apr 2013 10:48:12 -0500
User-agent: mu4e; emacs

Hello all,

Just FYI, if you're writing tests, I've made some changes to the way
they're written.  Dependencies have also changed, so be sure to run:

  ./bin/python develop

when doing a git pull.

./ should mostly continue to work as expected; however, if
you want to have tests run faster you can now take advantage of the fact
that we are using py.test and you can use -n5 to have the tests run in 5
concurrent processes at a time.

The short of it all is that the reason for the change is to allow for us
to more flexibly write tests for plugins and so on; previously we had
some issues with things exploding when running tests and switching out
the database configuration between plugins being enabled.  That's no
longer an issue with us using --boxed as we are now in test running with

If you're writing tests, you no longer use get_app() or the
@setup_fresh_app decorator.  Instead, the new method is a bit... magical
(more magical than I'd like, but I'm trying to work with the
infrastructure py.test has so we can nicely run tests in parallel and
self-contained).  Just do:

  def test_sometest(test_app):
      # foo

pytest will AUTOMATICALLY figure out that you want a test application
with your test and pass in said object.  I know, more magical than I'd
like!  But after a long battle with figuring out how to get this plugin
stuff to work, py.test's infrastructure makes it a lot easier (once you
figure it all out..)

In addition, if you wanted to write tests with different application
configurations, that's now possible.  I can work with interested people
in doing so on IRC.

 - Chris

reply via email to

[Prev in Thread] Current Thread [Next in Thread]