Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
assert scan_config('../project/') == expect
assert scan_config('.tmuxp.yaml') == expect
assert scan_config('../../.tmuxp/%s.yaml' % user_config_name) == str(
user_config
)
assert scan_config('myconfig') == str(user_config)
assert scan_config('~/.tmuxp/myconfig.yaml') == str(user_config)
with pytest.raises(Exception):
scan_config('.tmuxp.json')
with pytest.raises(Exception):
scan_config('.tmuxp.ini')
with pytest.raises(Exception):
scan_config('../')
with pytest.raises(Exception):
scan_config('mooooooo')
with homedir.as_cwd():
expect = project_config
assert scan_config('work/project') == expect
assert scan_config('work/project/') == expect
assert scan_config('./work/project') == expect
assert scan_config('./work/project/') == expect
assert scan_config('.tmuxp/%s.yaml' % user_config_name) == str(user_config)
assert scan_config('./.tmuxp/%s.yaml' % user_config_name) == str(user_config)
assert scan_config('myconfig') == str(user_config)
assert scan_config('~/.tmuxp/myconfig.yaml') == str(user_config)
with pytest.raises(Exception):
scan_config('')
with pytest.raises(Exception):
scan_config('.')
scan_config('mooooooo')
with configdir.as_cwd():
expect = project_config
assert scan_config('../work/project') == expect
assert scan_config('../../home/work/project') == expect
assert scan_config('../work/project/') == expect
assert scan_config('%s.yaml' % user_config_name) == str(user_config)
assert scan_config('./%s.yaml' % user_config_name) == str(user_config)
assert scan_config('myconfig') == str(user_config)
assert scan_config('~/.tmuxp/myconfig.yaml') == str(user_config)
with pytest.raises(Exception):
scan_config('')
with pytest.raises(Exception):
scan_config('.')
with pytest.raises(Exception):
scan_config('.tmuxp.yaml')
with pytest.raises(Exception):
scan_config('../')
with pytest.raises(Exception):
scan_config('mooooooo')
with tmpdir.as_cwd():
expect = project_config
assert scan_config('home/work/project') == expect
assert scan_config('./home/work/project/') == expect
assert scan_config('home/.tmuxp/%s.yaml' % user_config_name) == str(user_config)
assert scan_config('./home/.tmuxp/%s.yaml' % user_config_name) == str(
user_config
)
assert scan_config('myconfig') == str(user_config)
assert scan_config('~/.tmuxp/myconfig.yaml') == str(user_config)
with pytest.raises(Exception):
scan_config('')
with pytest.raises(Exception):
scan_config('.')
with pytest.raises(Exception):
scan_config('.tmuxp.yaml')
with pytest.raises(Exception):
scan_config('../')
with pytest.raises(Exception):
scan_config('mooooooo')
with tmpdir.as_cwd():
expect = project_config
assert scan_config('home/work/project') == expect
assert scan_config('./home/work/project/') == expect
assert scan_config('home/.tmuxp/%s.yaml' % user_config_name) == str(user_config)
assert scan_config('./home/.tmuxp/%s.yaml' % user_config_name) == str(
user_config
)
assert scan_config('myconfig') == str(user_config)
assert scan_config('~/.tmuxp/myconfig.yaml') == str(user_config)
with pytest.raises(Exception):
scan_config('')
with pytest.raises(Exception):
scan_config('.')
with pytest.raises(Exception):
scan_config('.tmuxp.yaml')
with pytest.raises(Exception):
scan_config('../')
scan_config('.')
with pytest.raises(Exception):
scan_config('.tmuxp.yaml')
with pytest.raises(Exception):
scan_config('../')
with pytest.raises(Exception):
scan_config('mooooooo')
with configdir.as_cwd():
expect = project_config
assert scan_config('../work/project') == expect
assert scan_config('../../home/work/project') == expect
assert scan_config('../work/project/') == expect
assert scan_config('%s.yaml' % user_config_name) == str(user_config)
assert scan_config('./%s.yaml' % user_config_name) == str(user_config)
assert scan_config('myconfig') == str(user_config)
assert scan_config('~/.tmuxp/myconfig.yaml') == str(user_config)
with pytest.raises(Exception):
scan_config('')
with pytest.raises(Exception):
scan_config('.')
with pytest.raises(Exception):
scan_config('.tmuxp.yaml')
with pytest.raises(Exception):
scan_config('../')
with pytest.raises(Exception):
scan_config('mooooooo')
with tmpdir.as_cwd():
expect = project_config
assert scan_config('home/work/project') == expect
with pytest.raises(Exception):
scan_config('.tmuxp.yaml')
with pytest.raises(Exception):
scan_config('../')
with pytest.raises(Exception):
scan_config('mooooooo')
with configdir.as_cwd():
expect = project_config
assert scan_config('../work/project') == expect
assert scan_config('../../home/work/project') == expect
assert scan_config('../work/project/') == expect
assert scan_config('%s.yaml' % user_config_name) == str(user_config)
assert scan_config('./%s.yaml' % user_config_name) == str(user_config)
assert scan_config('myconfig') == str(user_config)
assert scan_config('~/.tmuxp/myconfig.yaml') == str(user_config)
with pytest.raises(Exception):
scan_config('')
with pytest.raises(Exception):
scan_config('.')
with pytest.raises(Exception):
scan_config('.tmuxp.yaml')
with pytest.raises(Exception):
scan_config('../')
with pytest.raises(Exception):
scan_config('mooooooo')
with tmpdir.as_cwd():
expect = project_config
assert scan_config('home/work/project') == expect
assert scan_config('./home/work/project/') == expect
assert scan_config('~/.tmuxp/myconfig.yaml') == str(user_config)
with pytest.raises(Exception):
scan_config('.tmuxp.json')
with pytest.raises(Exception):
scan_config('.tmuxp.ini')
with pytest.raises(Exception):
scan_config('../')
with pytest.raises(Exception):
scan_config('mooooooo')
with homedir.as_cwd():
expect = project_config
assert scan_config('work/project') == expect
assert scan_config('work/project/') == expect
assert scan_config('./work/project') == expect
assert scan_config('./work/project/') == expect
assert scan_config('.tmuxp/%s.yaml' % user_config_name) == str(user_config)
assert scan_config('./.tmuxp/%s.yaml' % user_config_name) == str(user_config)
assert scan_config('myconfig') == str(user_config)
assert scan_config('~/.tmuxp/myconfig.yaml') == str(user_config)
with pytest.raises(Exception):
scan_config('')
with pytest.raises(Exception):
scan_config('.')
with pytest.raises(Exception):
scan_config('.tmuxp.yaml')
with pytest.raises(Exception):
scan_config('../')
with pytest.raises(Exception):
scan_config('mooooooo')
def test_resolve_dot(tmpdir, homedir, configdir, projectdir, monkeypatch):
monkeypatch.setenv('HOME', str(homedir))
projectdir.join('.tmuxp.yaml').ensure()
user_config_name = 'myconfig'
user_config = configdir.join('%s.yaml' % user_config_name).ensure()
project_config = str(projectdir.join('.tmuxp.yaml'))
with projectdir.as_cwd():
expect = project_config
assert scan_config('.') == expect
assert scan_config('./') == expect
assert scan_config('') == expect
assert scan_config('../project') == expect
assert scan_config('../project/') == expect
assert scan_config('.tmuxp.yaml') == expect
assert scan_config('../../.tmuxp/%s.yaml' % user_config_name) == str(
user_config
)
assert scan_config('myconfig') == str(user_config)
assert scan_config('~/.tmuxp/myconfig.yaml') == str(user_config)
with pytest.raises(Exception):
scan_config('.tmuxp.json')
with pytest.raises(Exception):
scan_config('.tmuxp.ini')
with pytest.raises(Exception):
scan_config('../')
def test_resolve_dot(tmpdir, homedir, configdir, projectdir, monkeypatch):
monkeypatch.setenv('HOME', str(homedir))
projectdir.join('.tmuxp.yaml').ensure()
user_config_name = 'myconfig'
user_config = configdir.join('%s.yaml' % user_config_name).ensure()
project_config = str(projectdir.join('.tmuxp.yaml'))
with projectdir.as_cwd():
expect = project_config
assert scan_config('.') == expect
assert scan_config('./') == expect
assert scan_config('') == expect
assert scan_config('../project') == expect
assert scan_config('../project/') == expect
assert scan_config('.tmuxp.yaml') == expect
assert scan_config('../../.tmuxp/%s.yaml' % user_config_name) == str(
user_config
)
assert scan_config('myconfig') == str(user_config)
assert scan_config('~/.tmuxp/myconfig.yaml') == str(user_config)
with pytest.raises(Exception):
scan_config('.tmuxp.json')
with pytest.raises(Exception):
scan_config('.tmuxp.ini')
with pytest.raises(Exception):
scan_config('../')
with pytest.raises(Exception):
scan_config('mooooooo')
with projectdir.as_cwd():
expect = project_config
assert scan_config('.') == expect
assert scan_config('./') == expect
assert scan_config('') == expect
assert scan_config('../project') == expect
assert scan_config('../project/') == expect
assert scan_config('.tmuxp.yaml') == expect
assert scan_config('../../.tmuxp/%s.yaml' % user_config_name) == str(
user_config
)
assert scan_config('myconfig') == str(user_config)
assert scan_config('~/.tmuxp/myconfig.yaml') == str(user_config)
with pytest.raises(Exception):
scan_config('.tmuxp.json')
with pytest.raises(Exception):
scan_config('.tmuxp.ini')
with pytest.raises(Exception):
scan_config('../')
with pytest.raises(Exception):
scan_config('mooooooo')
with homedir.as_cwd():
expect = project_config
assert scan_config('work/project') == expect
assert scan_config('work/project/') == expect
assert scan_config('./work/project') == expect
assert scan_config('./work/project/') == expect
assert scan_config('.tmuxp/%s.yaml' % user_config_name) == str(user_config)
assert scan_config('./.tmuxp/%s.yaml' % user_config_name) == str(user_config)
assert scan_config('myconfig') == str(user_config)
assert scan_config('myconfig') == str(user_config)
assert scan_config('~/.tmuxp/myconfig.yaml') == str(user_config)
with pytest.raises(Exception):
scan_config('.tmuxp.json')
with pytest.raises(Exception):
scan_config('.tmuxp.ini')
with pytest.raises(Exception):
scan_config('../')
with pytest.raises(Exception):
scan_config('mooooooo')
with homedir.as_cwd():
expect = project_config
assert scan_config('work/project') == expect
assert scan_config('work/project/') == expect
assert scan_config('./work/project') == expect
assert scan_config('./work/project/') == expect
assert scan_config('.tmuxp/%s.yaml' % user_config_name) == str(user_config)
assert scan_config('./.tmuxp/%s.yaml' % user_config_name) == str(user_config)
assert scan_config('myconfig') == str(user_config)
assert scan_config('~/.tmuxp/myconfig.yaml') == str(user_config)
with pytest.raises(Exception):
scan_config('')
with pytest.raises(Exception):
scan_config('.')
with pytest.raises(Exception):
scan_config('.tmuxp.yaml')
with pytest.raises(Exception):
scan_config('../')
with pytest.raises(Exception):