[py-svn] r63272 - py/extradoc/talk/pycon-us-2009/pytest-advanced
hpk at codespeak.net
hpk at codespeak.net
Tue Mar 24 11:46:08 CET 2009
Author: hpk
Date: Tue Mar 24 11:46:08 2009
New Revision: 63272
Modified:
py/extradoc/talk/pycon-us-2009/pytest-advanced/pytest-advanced.txt
Log:
more slides, new funcarg API
Modified: py/extradoc/talk/pycon-us-2009/pytest-advanced/pytest-advanced.txt
==============================================================================
--- py/extradoc/talk/pycon-us-2009/pytest-advanced/pytest-advanced.txt (original)
+++ py/extradoc/talk/pycon-us-2009/pytest-advanced/pytest-advanced.txt Tue Mar 24 11:46:08 2009
@@ -195,12 +195,70 @@
* test configuration mixes with code instantiation
* importing 'app' may fail because it misses dependencies
* the "app.pkg.SomeClass" reference may change
-* TestGroup functions share the same setup
+* functions tend to get grouped by setup
+
the test state setup question
==========================================
-what is the goal goals test state setup?
+how to setup and communicate test state?
+
+
+my current answers
+===========================
+
+* test tool drives test state setup
+* separate test state setup from test code
+
+meet py.test "funcargs"
+==========================================
+
+::
+ def pytest_configure(self, config):
+ config.register_funcarg("mysetup", MySetup(config))
+
+observations
+==========================================
+
+* called after command line parsing
+* allows to send test setup to test functions!
+
+class MySetup instanciation
+==========================================
+
+class MySetup:
+ def __init__(self, config):
+ self.config = config
+
+ def makepyfuncarg(self, pyfuncitem):
+ # pyfuncitem points into test collection
+ ...
+ return arginstance
+
+
+
+- can come from application!
+- will get its hook getfuncitem(
+
+
+
+goals for test suite organisation
+====================================
+
+* group your tests by aspects they test
+* continously re-group your test to match your app
+
+make good use of names for Test Classes and test functions
+
+basic "funcarg" mechanism
+==========================================
+
+configuration
+* think about setup of yourthink a about
+
+
+use setup_class
+(let's think of ways to get rid of it)
funcargs: per-function setup
More information about the pytest-commit
mailing list