some test fixes and refinements

This commit is contained in:
holger krekel 2010-11-01 08:16:10 +01:00
parent cf8dd64703
commit 85c24b7fa1
7 changed files with 13 additions and 14 deletions

View File

@ -5,7 +5,7 @@ see http://pytest.org for documentation and details
(c) Holger Krekel and others, 2004-2010
"""
__version__ = '2.0.0.dev14'
__version__ = '2.0.0.dev15'
__all__ = ['config', 'cmdline']

View File

@ -297,7 +297,7 @@ class Config(object):
if self.inicfg:
newargs = self.inicfg.get("addargs", None)
if newargs:
args[:] = args + py.std.shlex.split(newargs)
args[:] = py.std.shlex.split(newargs) + args
self._checkversion()
self.pluginmanager.consider_setuptools_entrypoints()
self.pluginmanager.consider_env()
@ -414,6 +414,7 @@ class Config(object):
def getcfg(args, inibasenames):
args = [x for x in args if str(x)[0] != "-"]
if not args:
args = [py.path.local()]
for inibasename in inibasenames:

View File

@ -22,7 +22,7 @@ def main():
name='pytest',
description='py.test: simple powerful testing with Python',
long_description = long_description,
version='2.0.0.dev14',
version='2.0.0.dev15',
url='http://pytest.org',
license='MIT license',
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],

View File

@ -13,6 +13,11 @@ class TestGeneralUsage:
'*ERROR: hello'
])
def test_file_not_found(self, testdir):
result = testdir.runpytest("asd")
assert result.ret != 0
result.stderr.fnmatch_lines(["ERROR: file not found*asd"])
def test_config_preparse_plugin_option(self, testdir):
testdir.makepyfile(pytest_xyz="""
def pytest_addoption(parser):

View File

@ -2,16 +2,6 @@ import py, sys
from pytest.plugin import python as funcargs
class TestModule:
def test_module_file_not_found(self, testdir):
tmpdir = testdir.tmpdir
fn = tmpdir.join('nada','no')
config=testdir.Config()
config.args = ["hello"]
col = py.test.collect.Module(fn, config=config,
collection=testdir.Collection(config))
col.config = testdir.parseconfig(tmpdir)
py.test.raises(py.error.ENOENT, col.collect)
def test_failing_import(self, testdir):
modcol = testdir.getmodulecol("import alksdjalskdjalkjals")
py.test.raises(ImportError, modcol.collect)

View File

@ -66,6 +66,9 @@ class TestConfigTmpdir:
assert not config2.getbasetemp().relto(config3.getbasetemp())
assert not config3.getbasetemp().relto(config2.getbasetemp())
def test_reparse_filename_too_long(self, testdir):
config = testdir.reparseconfig(["--basetemp=%s" % ("123"*300)])
class TestConfigAPI:
def test_config_getvalue_honours_conftest(self, testdir):

View File

@ -52,4 +52,4 @@ commands=
[pytest]
minversion=2.0
plugins=pytester
#addargs=-q -x
#addargs=-rf