def test_default(self): """ run parser: backend final fallback path """ self._unset_config() self._move_piglit_conf() args = run._run_parser(['quick.py', 'foo']) nt.assert_equal(args.backend, 'json')
def test_default(self): """ run parser: platform final fallback path """ self._unset_config() self._move_piglit_conf() args = run._run_parser(['quick.py', 'foo']) nt.assert_equal(args.platform, 'mixed_glx_egl')
def test_bad_value_in_conf(self): """ run parser: an error is raised when the platform in conf is bad """ self._unset_config() self._move_piglit_conf() # This has sideffects, it shouldn't effect anything in this module, but # it may cause later problems. But without this we get ugly error spew # from this test. sys.stderr = open(os.devnull, 'w') with utils.tempdir() as tdir: with open(os.path.join(tdir, 'piglit.conf'), 'w') as f: f.write('[core]\nplatform=foobar') run._run_parser(['-f', os.path.join(tdir, 'piglit.conf'), 'quick.py', 'foo'])
def test_env_no_options(self): """ Run parser: When no platform is passed env overrides default """ self.__set_env() args = run._run_parser(['quick.py', 'foo']) nt.assert_equal(args.platform, 'glx')
def test_option_conf(self): """ Run parser: backend option replaces conf """ with utils.tempdir() as tdir: os.environ['XDG_CONFIG_HOME'] = tdir with open(os.path.join(tdir, 'piglit.conf'), 'w') as f: f.write(self._CONF) args = run._run_parser(['-b', 'json', 'quick.py', 'foo']) nt.assert_equal(args.backend, 'json')
def test_option_conf(self): """ Run parser: platform option replaces conf """ with utils.tempdir() as tdir: os.environ['XDG_CONFIG_HOME'] = tdir with open(os.path.join(tdir, 'piglit.conf'), 'w') as f: f.write(self._CONF) args = run._run_parser(['-p', 'x11_egl', 'quick.py', 'foo']) nt.assert_equal(args.platform, 'x11_egl')
def test_option_conf(self): """ Run parser: platform option replaces conf """ with utils.nose.tempdir() as tdir: os.environ['XDG_CONFIG_HOME'] = tdir with open(os.path.join(tdir, 'piglit.conf'), 'w') as f: f.write(self._CONF) args = run._run_parser(['-p', 'x11_egl', 'quick.py', 'foo']) nt.assert_equal(args.platform, 'x11_egl')
def test_bad_value_in_conf(self): """ run parser: an error is raised when the platform in conf is bad """ self._unset_config() self._move_piglit_conf() # This has sideffects, it shouldn't effect anything in this module, but # it may cause later problems. But without this we get ugly error spew # from this test. sys.stderr = open(os.devnull, 'w') with utils.tempdir() as tdir: with open(os.path.join(tdir, 'piglit.conf'), 'w') as f: f.write('[core]\nplatform=foobar') with nt.assert_raises(SystemExit): run._run_parser([ '-f', os.path.join(tdir, 'piglit.conf'), 'quick.py', 'foo' ])
def test_conf_default(self): """ Run parser platform: conf is used as a default when applicable """ self._unset_config() self._move_piglit_conf() with utils.tempdir() as tdir: os.environ['XDG_CONFIG_HOME'] = tdir with open(os.path.join(tdir, 'piglit.conf'), 'w') as f: f.write(self._CONF) args = run._run_parser(['quick.py', 'foo']) nt.assert_equal(args.backend, 'junit')
def test_conf_default(self): """ Run parser platform: conf is used as a default when applicable """ self._unset_config() self._move_piglit_conf() with utils.tempdir() as tdir: os.environ['XDG_CONFIG_HOME'] = tdir with open(os.path.join(tdir, 'piglit.conf'), 'w') as f: f.write(self._CONF) args = run._run_parser(['quick.py', 'foo']) nt.assert_equal(args.platform, 'gbm')
def test_env_conf(self): """ Run parser: env overwrides a conf value """ self._unset_config() self._move_piglit_conf() self.__set_env() with utils.tempdir() as tdir: os.environ['XDG_CONFIG_HOME'] = tdir with open(os.path.join(tdir, 'piglit.conf'), 'w') as f: f.write(self._CONF) args = run._run_parser(['quick.py', 'foo']) nt.assert_equal(args.platform, 'glx')
def test_option_default(self): """ Run parser: platform replaces default """ args = run._run_parser(['-p', 'x11_egl', 'quick.py', 'foo']) nt.assert_equal(args.platform, 'x11_egl')
def test_option_env(self): """ Run parser: platform option replaces env """ self.__set_env() args = run._run_parser(['-p', 'x11_egl', 'quick.py', 'foo']) nt.assert_equal(args.platform, 'x11_egl')
def test_option_default(self): """ Run parser: backend replaces default """ args = run._run_parser(['-b', 'json', 'quick.py', 'foo']) nt.assert_equal(args.backend, 'json')