예제 #1
0
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
예제 #2
0
def test_clean_without_maps_dir_doesnt_raise_exception():
    shutil.rmtree(
        str((htmap.settings['HTMAP_DIR'] / 'maps').absolute()),
        ignore_errors=True,
    )

    htmap.clean()
예제 #3
0
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', )
예제 #4
0
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
예제 #5
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)
예제 #6
0
파일: cli.py 프로젝트: elin1231/htmap
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)}')
예제 #7
0
def clean_after_test():
    yield

    htmap.clean(all = True)
예제 #8
0
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)}')