-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✅ Add initial tests for shui.functions.extract_tarball
- Loading branch information
1 parent
613a7f9
commit 4ba38b0
Showing
3 changed files
with
43 additions
and
2 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
4c63792055a083e8c770370f22240853dc64da96e3200c7aa2710607b841bb0972c29eece43b068dd11c4f77719427b6c48df27e6e389efd664fb3e9b9743f9f |
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,38 @@ | ||
import pytest | ||
from pathlib3x import Path | ||
|
||
from shui.classes import FileInfo, FileWithHash | ||
from shui.functions import extract_tarball | ||
|
||
|
||
@pytest.fixture | ||
def fixtures_directory() -> Path: | ||
return Path(__file__).parent.parent.resolve() / "fixtures" | ||
|
||
|
||
@pytest.fixture | ||
def filewithhash(testfile: FileInfo, testhashfile: FileInfo) -> FileWithHash: | ||
return FileWithHash(testfile, testhashfile) | ||
|
||
|
||
@pytest.fixture | ||
def spark_example_tgz(fixtures_directory: Path) -> bytes: | ||
return FileInfo( | ||
"https://example.com/example.tgz", fixtures_directory / "example.tgz" | ||
) | ||
|
||
|
||
@pytest.fixture | ||
def spark_example_tgz_hash(fixtures_directory: Path) -> FileInfo: | ||
return FileInfo( | ||
"https://example.com/example.tgz.sha512", | ||
fixtures_directory / "example.tgz.sha512", | ||
) | ||
|
||
|
||
def test_extract_tarball( | ||
spark_example_tgz: FileInfo, spark_example_tgz_hash: FileInfo, tmp_path: Path | ||
) -> None: | ||
file_with_hash = FileWithHash(spark_example_tgz, spark_example_tgz_hash) | ||
install_dir = Path(tmp_path) / "install" | ||
assert extract_tarball(file_with_hash.file, install_dir) == install_dir / "spark" |