Rewrite integration test using py.test

This commit is contained in:
Takafumi Arakaki
2013-03-10 15:52:37 +01:00
parent 3b41a47c08
commit 9018cea22e
2 changed files with 129 additions and 0 deletions

26
test/conftest.py Normal file
View File

@@ -0,0 +1,26 @@
from os.path import join, dirname, abspath
default_base_dir = join(dirname(abspath(__file__)), 'completion')
import run
def pytest_addoption(parser):
parser.addoption(
"--base-dir", default=default_base_dir,
help="Directory in which integration test case files locate.")
parser.addoption(
"--thirdparty",
help="Include integration tests that requires third party modules.")
def pytest_generate_tests(metafunc):
"""
:type metafunc: _pytest.python.Metafunc
"""
if 'case' in metafunc.fixturenames:
base_dir = metafunc.config.option.base_dir
test_files = {}
thirdparty = metafunc.config.option.thirdparty
metafunc.parametrize(
'case',
run.collect_dir_tests(base_dir, test_files, thirdparty))