Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue in Job Files Manager Test #421

Closed
wants to merge 11 commits into from
2 changes: 1 addition & 1 deletion jupyter_scheduler/job_files_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def download_tar(self, archive_format: str = "tar"):

with fsspec.open(archive_filepath) as f:
with tarfile.open(fileobj=f, mode=read_mode) as tar:
tar.extractall(self.output_dir, filter="data")
tar.extractall(self.output_dir)

def download(self):
if not self.staging_paths:
Expand Down
22 changes: 8 additions & 14 deletions jupyter_scheduler/tests/test_job_files_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,11 @@ def clear_outputs_dir():
),
(
["ipynb", "html"],
# When using tar.gz files for output, files are not renamed to output filenames
{
"ipynb": "helloworld-out.ipynb",
"html": "helloworld-out.html",
"input": "helloworld-input.ipynb",
"ipynb": "helloworld-1.ipynb",
"html": "helloworld-1.html",
"input": "helloworld.ipynb",
},
{
"tar.gz": os.path.join(HERE, "test_staging_dir", "job-2", "helloworld.tar.gz"),
Expand All @@ -120,16 +121,9 @@ def test_downloader_download(

assert os.path.exists(output_dir)
for format in output_formats:
out_filepath = os.path.join(output_dir, output_filenames[format])

assert os.path.exists(out_filepath)

if "tar.gz" in staging_paths:
with tarfile.open(staging_paths["tar.gz"]) as tar:
input_file = tar.extractfile(member=staging_paths[format])
input_filepath = os.path.join(output_dir, os.path.basename(staging_paths[format]))
with open(input_filepath, "wb") as f:
f.write(input_file.read())
assert filecmp.cmp(out_filepath, input_filepath)
if format == "tar.gz":
pass # Ignore the tarfile, which has been downloaded and extracted
else:
out_filepath = os.path.join(output_dir, output_filenames[format])
assert os.path.exists(out_filepath)
assert filecmp.cmp(out_filepath, staging_paths[format])
Loading