-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle ValueError when trying to parse .keep_dir files that hold no package atom, also add some tests. Signed-off-by: gcarq <[email protected]>
- Loading branch information
Showing
3 changed files
with
35 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,9 @@ authors = [ | |
{name = 'Michael Egger', email = '[email protected]'}, | ||
] | ||
|
||
[dev-dependencies] | ||
test = ["pytest"] | ||
|
||
[project.scripts] | ||
lostfiles = "lostfiles:main" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from unittest.mock import patch | ||
|
||
from lostfiles import resolve_pkg_from_keepfile, should_ignore_path | ||
|
||
|
||
def test_resolve_pkg_from_keepfile(): | ||
assert resolve_pkg_from_keepfile(".keep_net-print_cups-0") == "net-print/cups" | ||
assert resolve_pkg_from_keepfile(".keep_sys-apps_systemd-0") == "sys-apps/systemd" | ||
assert resolve_pkg_from_keepfile(".keep_dir") is None | ||
|
||
|
||
@patch("lostfiles.IGNORED_PATHS", {"/ignored"}) | ||
def test_should_ignore_path(*args, **kwargs): | ||
assert should_ignore_path("/ignored") is True | ||
assert should_ignore_path("/not_ignored") is False | ||
assert should_ignore_path("/not_ignored/.keep") is True |