some test fixes and refinements
This commit is contained in:
parent
cf8dd64703
commit
85c24b7fa1
|
@ -5,7 +5,7 @@ see http://pytest.org for documentation and details
|
||||||
|
|
||||||
(c) Holger Krekel and others, 2004-2010
|
(c) Holger Krekel and others, 2004-2010
|
||||||
"""
|
"""
|
||||||
__version__ = '2.0.0.dev14'
|
__version__ = '2.0.0.dev15'
|
||||||
|
|
||||||
__all__ = ['config', 'cmdline']
|
__all__ = ['config', 'cmdline']
|
||||||
|
|
||||||
|
|
|
@ -297,7 +297,7 @@ class Config(object):
|
||||||
if self.inicfg:
|
if self.inicfg:
|
||||||
newargs = self.inicfg.get("addargs", None)
|
newargs = self.inicfg.get("addargs", None)
|
||||||
if newargs:
|
if newargs:
|
||||||
args[:] = args + py.std.shlex.split(newargs)
|
args[:] = py.std.shlex.split(newargs) + args
|
||||||
self._checkversion()
|
self._checkversion()
|
||||||
self.pluginmanager.consider_setuptools_entrypoints()
|
self.pluginmanager.consider_setuptools_entrypoints()
|
||||||
self.pluginmanager.consider_env()
|
self.pluginmanager.consider_env()
|
||||||
|
@ -414,6 +414,7 @@ class Config(object):
|
||||||
|
|
||||||
|
|
||||||
def getcfg(args, inibasenames):
|
def getcfg(args, inibasenames):
|
||||||
|
args = [x for x in args if str(x)[0] != "-"]
|
||||||
if not args:
|
if not args:
|
||||||
args = [py.path.local()]
|
args = [py.path.local()]
|
||||||
for inibasename in inibasenames:
|
for inibasename in inibasenames:
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -22,7 +22,7 @@ def main():
|
||||||
name='pytest',
|
name='pytest',
|
||||||
description='py.test: simple powerful testing with Python',
|
description='py.test: simple powerful testing with Python',
|
||||||
long_description = long_description,
|
long_description = long_description,
|
||||||
version='2.0.0.dev14',
|
version='2.0.0.dev15',
|
||||||
url='http://pytest.org',
|
url='http://pytest.org',
|
||||||
license='MIT license',
|
license='MIT license',
|
||||||
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
|
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
|
||||||
|
|
|
@ -13,6 +13,11 @@ class TestGeneralUsage:
|
||||||
'*ERROR: hello'
|
'*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):
|
def test_config_preparse_plugin_option(self, testdir):
|
||||||
testdir.makepyfile(pytest_xyz="""
|
testdir.makepyfile(pytest_xyz="""
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
|
|
|
@ -2,16 +2,6 @@ import py, sys
|
||||||
from pytest.plugin import python as funcargs
|
from pytest.plugin import python as funcargs
|
||||||
|
|
||||||
class TestModule:
|
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):
|
def test_failing_import(self, testdir):
|
||||||
modcol = testdir.getmodulecol("import alksdjalskdjalkjals")
|
modcol = testdir.getmodulecol("import alksdjalskdjalkjals")
|
||||||
py.test.raises(ImportError, modcol.collect)
|
py.test.raises(ImportError, modcol.collect)
|
||||||
|
|
|
@ -66,6 +66,9 @@ class TestConfigTmpdir:
|
||||||
assert not config2.getbasetemp().relto(config3.getbasetemp())
|
assert not config2.getbasetemp().relto(config3.getbasetemp())
|
||||||
assert not config3.getbasetemp().relto(config2.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:
|
class TestConfigAPI:
|
||||||
|
|
||||||
def test_config_getvalue_honours_conftest(self, testdir):
|
def test_config_getvalue_honours_conftest(self, testdir):
|
||||||
|
|
Loading…
Reference in New Issue