[svn r62981] allowing conftest to set default values for options

--HG--
branch : trunk
This commit is contained in:
hpk
2009-03-17 07:10:40 +01:00
parent b5a1f95856
commit 771ce92fdf
7 changed files with 63 additions and 24 deletions
+5 -9
View File
@@ -60,16 +60,12 @@ class DSession(Session):
if config.option.numprocesses:
return
try:
config.getvalue('dist_hosts')
config.getvalue('hosts')
except KeyError:
print "Don't know where to distribute tests to. You may want"
print "to specify either a number of local processes to start"
print "with '--numprocesses=NUM' or specify 'dist_hosts' in a local"
print "conftest.py file, for example:"
print
print " dist_hosts = ['localhost'] * 4 # for 3 processors"
print " dist_hosts = ['you@remote.com', '...'] # for testing on ssh accounts"
print " # with your remote ssh accounts"
print "Please specify hosts for distribution of tests:"
print "cmdline: --hosts=host1,host2,..."
print "conftest.py: pytest_option_hosts=['host1','host2',]"
print "environment: PYTEST_OPTION_HOSTS=host1,host2,host3"
print
print "see also: http://codespeak.net/py/current/doc/test.html#automated-distributed-testing"
raise SystemExit
+1 -1
View File
@@ -6,7 +6,7 @@ from py.__.test import event
def getconfighosts(config):
if config.option.numprocesses:
hosts = ['localhost'] * config.option.numprocesses
hosts = ['popen'] * config.option.numprocesses
else:
hosts = config.option.hosts
if not hosts:
+6 -6
View File
@@ -300,17 +300,17 @@ class TestDSession:
remaining = session.filteritems(items)
assert remaining == []
evname, ev = evrec.events[-1]
assert evname == "deselected"
assert ev.items == items
event = evrec.events[-1]
assert event.name == "deselected"
assert event.args[0].items == items
modcol._config.option.keyword = "test_fail"
remaining = session.filteritems(items)
assert remaining == [items[0]]
evname, ev = evrec.events[-1]
assert evname == "deselected"
assert ev.items == [items[1]]
event = evrec.events[-1]
assert event.name == "deselected"
assert event.args[0].items == [items[1]]
def test_hostdown_shutdown_after_completion(self, testdir):
item = testdir.getitem("def test_func(): pass")