def test_boxed_option_from_conftest2(self): tmpdir = self.tmpdir tmpdir.join("conftest.py").write(py.code.Source(""" dist_boxed = False """)) config = py.test.config._reparse([tmpdir, '--box']) assert config.option.boxed config.initsession() assert config.option.boxed
def test_boxed_option_default(self): self.tmpdir.join("conftest.py").write("dist_hosts=[]") tmpdir = self.tmpdir.ensure("subdir", dir=1) config = py.test.config._reparse([tmpdir]) config.initsession() assert not config.option.boxed config = py.test.config._reparse(['--dist', tmpdir]) config.initsession() assert not config.option.boxed
def test_boxed_option_from_conftest(self): self.tmpdir.join("conftest.py").write("dist_hosts=[]") tmpdir = self.tmpdir.ensure("subdir", dir=1) tmpdir.join("conftest.py").write(py.code.Source(""" dist_hosts = [] dist_boxed = True """)) config = py.test.config._reparse(['--dist', tmpdir]) config.initsession() assert config.option.boxed
def test_sessionname_lookup_custom(self): self.tmpdir.join("conftest.py").write(py.code.Source(""" from py.__.test.session import Session class MySession(Session): def __init__(self, config): self.config = config """)) config = py.test.config._reparse(["--session=MySession", self.tmpdir]) session = config.initsession() assert session.__class__.__name__ == 'MySession'
def test_initsession(self): config = py.test.config._reparse([self.tmpdir]) session = config.initsession() assert session.config is config