Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
drammock committed Jan 4, 2021
1 parent fda6407 commit f9f8dc7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions pooch/processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ def __call__(self, fname, action, pooch):
)
if self.extract_dir is None:
self.extract_dir = fname + self.suffix
elif self.suffix is not None:
get_logger().warn("Ignoring 'suffix' because 'extract_dir' was provided.")
else:
archive_dir = fname.rsplit(os.path.sep, maxsplit=1)[0]
self.extract_dir = os.path.join(archive_dir, self.extract_dir)
if action in ("update", "download") or not os.path.exists(self.extract_dir):
# Make sure that the folder with the extracted files exists
if not os.path.exists(self.extract_dir):
Expand Down
4 changes: 2 additions & 2 deletions pooch/tests/test_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def test_extractprocessor_fails():


@pytest.mark.parametrize(
"proc_cls,ext,dir",
"proc_cls,ext,_dir",
[
(Unzip, ".zip", None),
(Untar, ".tar.gz", None),
Expand All @@ -122,7 +122,7 @@ def test_extractprocessor_fails():
)
def test_processors(proc_cls, ext, _dir):
"Setup a hook and make sure it's only executed when downloading"
processor = proc_cls(members=["tiny-data.txt"])
processor = proc_cls(members=["tiny-data.txt"], extract_dir=_dir)
suffix = proc_cls.suffix
extract_dir = "tiny-data" + ext + suffix if _dir is None else _dir
with TemporaryDirectory() as local_store:
Expand Down

0 comments on commit f9f8dc7

Please sign in to comment.