def test_clean_all_cleans_all_maps(mapped_doubler): mapped_doubler.map(range(1), tag='yes-me') mapped_doubler.map(range(1)) htmap.clean(all=True) assert len(htmap.get_tags()) == 0
def test_clean_without_maps_dir_doesnt_raise_exception(): shutil.rmtree( str((htmap.settings['HTMAP_DIR'] / 'maps').absolute()), ignore_errors=True, ) htmap.clean()
def test_clean_only_removes_transient_maps(mapped_doubler): mapped_doubler.map(range(1), tag='not-me') mapped_doubler.map(range(1)) htmap.clean() assert htmap.get_tags() == ('not-me', )
def test_clean_removes_all_transient_maps(mapped_doubler): mapped_doubler.map(range(1)) mapped_doubler.map(range(1)) mapped_doubler.map(range(1)) htmap.clean() assert len(htmap.get_tags()) == 0
def set_htmap_dir_and_clean(tmpdir_factory): map_dir = Path(tmpdir_factory.mktemp("htmap_dir")) htmap.settings["HTMAP_DIR"] = map_dir ensure_htmap_dir_exists() yield htmap.clean(all=True)
def clean(all): """ Clean up transient maps by removing them. Maps that have never had a tag explicitly set are assigned randomized tags and marked as "transient". This command removes maps marked transient (and can also remove all maps, not just transient ones, if the --all option is passed). """ with make_spinner("Cleaning maps...") as spinner: cleaned_tags = htmap.clean(all=all) spinner.succeed(f'Cleaned maps {", ".join(cleaned_tags)}')
def clean_after_test(): yield htmap.clean(all = True)
def clean(all): """Clean up maps.""" with make_spinner('Cleaning maps...') as spinner: cleaned_tags = htmap.clean(all=all) spinner.succeed(f'Cleaned maps {", ".join(cleaned_tags)}')