コード例 #1
0
def test_www_root_defaults_to_cwd(mk):
    mk()
    c = Configurable()
    c.configure([])
    expected = os.path.realpath(os.getcwd())
    actual = c.www_root
    assert actual == expected
コード例 #2
0
def test_configurable_sees_root_option(mk):
    mk()
    c = Configurable()
    c.configure(['--www_root', FSFIX])
    expected = os.getcwd()
    actual = c.www_root
    assert actual == expected
コード例 #3
0
def test_ConfigurationError_NOT_raised_if_no_cwd_but_do_have__www_root(mk):
    mk()
    foo = os.getcwd()
    os.chdir(FSFIX)
    os.rmdir(os.getcwd())
    c = Configurable()
    c.configure(['--www_root', foo])
    expected = foo
    actual = c.www_root
    assert actual == expected
コード例 #4
0
def test_ConfigurationError_raised_if_no_cwd(mk):
    mk()
    os.chdir(FSFIX)
    os.rmdir(FSFIX)
    c = Configurable()
    raises(ConfigurationError, c.configure, [])
コード例 #5
0
def test_configuration_scripts_arent_confused_by_io_errors(mk):
    CONFIG = "open('this file should not exist')\n"
    mk(('configure-aspen.py', CONFIG))
    c = Configurable()
    actual = raises(IOError, c.configure, ['-p', FSFIX]).value
    assert actual.strerror == 'No such file or directory'