def test_commands(self): config = Config(FILES) shutil.rmtree(config.location, ignore_errors=True) assert not os.path.exists(config.location) # install sources assert gdm.install(root=FILES) assert 'gdm_1' in os.listdir(config.location) assert 'gdm_2' in os.listdir(config.location) # list versions assert gdm.list(FILES) # update sources assert gdm.update(root=FILES) assert 'gdm_1' in os.listdir(config.location) assert 'gdm_2' in os.listdir(config.location) # install locked sources assert gdm.install(root=FILES) assert 'gdm_1' in os.listdir(config.location) assert 'gdm_2' in os.listdir(config.location) # uninstall sources assert gdm.uninstall(root=FILES) assert not os.path.isdir(config.location)
def it_should_delete_dependencies_when_they_exist(config): gdm.install('gdm_1', depth=1) assert os.path.isdir(config.location) assert gdm.uninstall() assert not os.path.exists(config.location)
def it_should_use_locked_sources_if_available(config): config.__mapper__.text = strip(""" location: deps sources: - dir: gdm_1 link: '' repo: https://github.com/jacebrowning/gdm-demo rev: example-branch sources_locked: - dir: gdm_2 link: '' repo: https://github.com/jacebrowning/gdm-demo rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04 """) assert gdm.install(depth=1) assert ['gdm_2'] == os.listdir(config.location)
def it_should_create(config_with_link): assert gdm.install(depth=1) assert 'my_link' in os.listdir()
def it_should_not_modify_config(config): assert gdm.install('gdm_1', depth=1) assert CONFIG == config.__mapper__.text
def it_should_create_missing_directories(config): assert not os.path.isdir(config.location) assert gdm.install('gdm_1', depth=1) assert ['gdm_1'] == os.listdir(config.location)
def it_should_overwrite_with_force(config_with_link): os.system("touch my_link") assert gdm.install(depth=1, force=True)
def it_should_not_overwrite(config_with_link): os.system("touch my_link") with pytest.raises(RuntimeError): gdm.install(depth=1)