File: test_clean.py

package info (click to toggle)
apt-mirror2 15-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,388 kB
  • sloc: python: 5,337; sh: 23; makefile: 14
file content (40 lines) | stat: -rw-r--r-- 1,141 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from pathlib import Path

from apt_mirror.apt_mirror import PathCleaner
from tests.base import BaseTest


class TestRepository(BaseTest):
    def test_wipe_threashold(self):
        clean_path = self.TEST_DATA / "PathClean"

        cleaner = PathCleaner(
            clean_path, set(), wipe_size_ratio=0, wipe_count_ratio=0.6
        )

        self.assertFalse(
            cleaner._clean_allowed()  # pylint: disable=W0212 # type: ignore
        )

        cleaner = PathCleaner(
            clean_path, set(), wipe_size_ratio=0.6, wipe_count_ratio=0
        )

        self.assertFalse(
            cleaner._clean_allowed()  # pylint: disable=W0212 # type: ignore
        )

        cleaner = PathCleaner(
            clean_path, {Path("1")}, wipe_size_ratio=0.7, wipe_count_ratio=0
        )

        self.assertTrue(
            cleaner._clean_allowed()  # pylint: disable=W0212 # type: ignore
        )
        cleaner = PathCleaner(
            clean_path, {Path("1")}, wipe_size_ratio=0, wipe_count_ratio=0.7
        )

        self.assertTrue(
            cleaner._clean_allowed()  # pylint: disable=W0212 # type: ignore
        )